├── README.assets ├── image-20220110145811446.png ├── image-20220110145950367.png ├── image-20220110150044489.png ├── image-20220110150315478.png ├── image-20220110150541820.png ├── image-20220110150644138.png ├── image-20220110150729106.png ├── image-20220110150919807.png └── image-20220110151849508.png ├── .gitignore ├── README.md ├── Redis6在Windows单机下伪集群安装部署指南.md └── LICENSE /README.assets/image-20220110145811446.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110145811446.png -------------------------------------------------------------------------------- /README.assets/image-20220110145950367.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110145950367.png -------------------------------------------------------------------------------- /README.assets/image-20220110150044489.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110150044489.png -------------------------------------------------------------------------------- /README.assets/image-20220110150315478.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110150315478.png -------------------------------------------------------------------------------- /README.assets/image-20220110150541820.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110150541820.png -------------------------------------------------------------------------------- /README.assets/image-20220110150644138.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110150644138.png -------------------------------------------------------------------------------- /README.assets/image-20220110150729106.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110150729106.png -------------------------------------------------------------------------------- /README.assets/image-20220110150919807.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110150919807.png -------------------------------------------------------------------------------- /README.assets/image-20220110151849508.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wjw465150/redis-win-6_and_7-win64/master/README.assets/image-20220110151849508.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # redis-win-6-win64 2 | 自己编译好的windows下的64位的redis6可执行程序包. 3 | 4 | 5 | ## 背景说明 6 | 7 | - 在github上面仅能够找到 redis3.2.100的Windows安装文件 8 | - 比较新的版本比较难以找到, 同事经常出现这个版本的redis卡死的情况, 所以想尝试进行一下升级. 9 | 10 | ## 第 一步 下载文件 11 | 12 | 13 | 下载 cygwin的安装文件 14 | 15 | ``` 16 | https://cygwin.com/setup-x86_64.exe 17 | ``` 18 | 19 | 下载redis的安装文件 20 | 21 | ``` 22 | https://download.redis.io/releases/redis-6.0.26.tar.gz 23 | ``` 24 | 25 | ## 第 二步 cygwin的安装与设置 26 | 27 | 双击安装即可. 28 | 29 | ![image-20220110145811446](README.assets/image-20220110145811446.png) 30 | 31 | 注意选择使用`Install from internet` 32 | 33 | - 需要注意使用 `Root directory` 需要记住 34 | - 后续编译的文件也是以这个文件为根目录进行处理的. 35 | 36 | ![image-20220110145950367](README.assets/image-20220110145950367.png) 37 | 38 | - 下一步的`Local Packages Directory` 指的是互联网下载的临时路径. 39 | 40 | ![image-20220110150044489](README.assets/image-20220110150044489.png) 41 | 42 | 注意选择互联网安装可以add 一个 阿里云的 默认镜像,不然可能无法安装 43 | 44 | ``` 45 | http://mirrors.aliyun.com/cygwin/ 46 | ``` 47 | 48 | ![image-20220110150315478](README.assets/image-20220110150315478.png) 49 | 50 | - 注意这里需要通过Search 将部分组件添加进来以便进行编译.需要添加的主要有: 51 | 52 | ``` 53 | pkg-config make gcc-core gcc-g++ libgcc1 libgccpp1 54 | ``` 55 | 56 | ![image-20220110150541820](README.assets/image-20220110150541820.png) 57 | 58 | - 注意 每一个单独的包都需要单独进行下载然后进行安装不能偷懒. 59 | - 注意不要全部下载 不然会打爆磁盘 60 | - 选择完成之后点击下一步进行安装即可 61 | 62 | ![image-20220110150644138](README.assets/image-20220110150644138.png) 63 | 64 | - 注意 这一步可能会很漫长,需要慢慢等待,有下载和安装的步骤 65 | 66 | ![image-20220110150729106](README.assets/image-20220110150729106.png) 67 | 68 | **安装完成之后就可以进行后续的编译操作了** 69 | 70 | ## 第 三步 编译安装redis6 71 | 72 | - 启动cygwin 73 | 74 | ![image-20220110150919807](README.assets/image-20220110150919807.png) 75 | 76 | - 修改`cygwin64/usr/include/dlfcn.h`文件 77 | 78 | 找到`Dl_info`定义的地方,删除上面的 `#if` 和 下面的 `#endif` 两 行. 79 | 80 | - 把redis的tar包放到`cygwin64/tmp`目录下 81 | 82 | ```bash 83 | tar -zxvf redis-6.2.6.tar.gz 84 | cd redis-6.2.6 85 | make 86 | ``` 87 | 88 | ## 第 四步 启动验证 89 | 90 | - 需要在 `redis-6.2.6/src` 里面将所有的生成的exe文件抽取出来 91 | 92 | ``` 93 | redis-benchmark.exe 94 | redis-check-aof.exe 95 | redis-check-rdb.exe 96 | redis-cli.exe 97 | redis-sentinel.exe 98 | redis-server.exe 99 | ``` 100 | 101 | 102 | 103 | - 需要把`cygwin64/bin` 目录下面的 `cygwin1.dll`这个文件一起放到`redis-server.exe`文件所在的目录里面 104 | 105 | - 打开命令行,执行`redis-server.exe`,输出如下: 106 | 107 | ![image-20220110151849508](README.assets/image-20220110151849508.png) 108 | 109 | Redis6在Windows下的编译安装完成! 110 | -------------------------------------------------------------------------------- /Redis6在Windows单机下伪集群安装部署指南.md: -------------------------------------------------------------------------------- 1 | # Redis6在Windows单机下伪集群安装部署指南 2 | 3 | ## 前言 4 | 5 | redis集群化部署主要用于大型缓存架构.一般的小型架构,使用redis主从配置就行. 6 | 7 | 使用redis集群可以方便快捷地对集群进行动态扩容,动态的添加、删除节点,reshard、并带有自动故障恢复功能。 8 | 9 | 一般redis集群使用3主3从,并且尽量保证主服务器与从服务器不在同一台机器上,防止机器故障导致的集群瘫痪,每个主 服务器搭配一个从服务器,保证集群的高可用性。 10 | 11 | **软件版本:** 12 | 13 | - OS:Windows10-64位 14 | 15 | - Redis:redis-win-6.2.6-win64.zip(下载地址`https://github.com/wjw465150/redis-win-6-win64`) 16 | 17 | # Redis配置 18 | 19 | 假设Redis解压在`D:\redis-win-6.2.6-win64`目录下.建立配置Redis集群时会用到的文件夹: 20 | 21 | ```bash 22 | D:\redis-win-6.2.6-win64\conf 23 | D:\redis-win-6.2.6-win64\log 24 | D:\redis-win-6.2.6-win64\run 25 | 26 | D:\redis-win-6.2.6-win64\data\7001 27 | D:\redis-win-6.2.6-win64\data\7002 28 | D:\redis-win-6.2.6-win64\data\7003 29 | D:\redis-win-6.2.6-win64\data\8001 30 | D:\redis-win-6.2.6-win64\data\8002 31 | D:\redis-win-6.2.6-win64\data\8003 32 | ``` 33 | 34 | **创建redis配置文件:** `D:\redis-win-6.2.6-win64\conf\redis_7001.conf` 35 | 36 | 打开`redis_7001.conf`文件,修改成以下内容: 37 | 38 | ```ini 39 | #添加本机的ip 40 | bind 0.0.0.0 41 | #端口 42 | port 7001 43 | 44 | #AOF持久化 45 | save #save后给空值,表示禁用RDB持久化策略 46 | appendonly yes 47 | #守护进程 48 | daemonize yes 49 | 50 | #pid存储目录 51 | pidfile ./run/redis_7001.pid 52 | #日志存储目录 53 | logfile ./log/redis_7001.log 54 | #数据存储目录,目录要提前创建好 55 | dir ./data/7001 56 | 57 | #开启集群 58 | cluster-enabled yes 59 | #集群节点配置文件,这个文件是不能手动编辑的。确保每一个集群节点的配置文件不同 60 | cluster-config-file nodes_7001.conf 61 | #集群节点的超时时间,单位:ms,超时后集群会认为该节点失败 62 | cluster-node-timeout 15000 63 | 64 | #->@wjw_note: 一下是根据实际情况来填写 65 | # Close the connection after a client is idle for N seconds (0 to disable) 66 | timeout 0 67 | loglevel warning 68 | databases 16 69 | # 设置Redis占用内存的大小 70 | maxmemory 100mb 71 | 72 | # 如果内存满了就需要按照如相应算法进行删除过期的/最老的 73 | # volatile-lru 根据LRU算法移除设置了过期的key 74 | # allkeys-lru 根据LRU算法移除任何key(包含那些未设置过期时间的key) 75 | # volatile-random/allkeys->random 使用随机算法而不是LRU进行删除 76 | # volatile-ttl 根据Time-To-Live移除即将过期的key 77 | # noeviction 永不过期,而是报错 78 | maxmemory-policy volatile-lru 79 | # Redis并不是真正的LRU/TTL,而是基于采样进行移除的,即如采样10个数据移除其中最老的/即将过期的 80 | maxmemory-samples 10 81 | # 持久化策略,默认每秒fsync一次,也可以选择always即每次操作都进行持久化,或者no表示不进行持久化而是借助操作系统的同步将缓存区数据写到磁盘 82 | appendfsync everysec 83 | 84 | # AOF重写策略(同时满足如下两个策略进行重写) 85 | # 当AOF文件大小占到初始文件大小的多少百分比时进行重写 86 | auto-aof-rewrite-percentage 100 87 | # 触发重写的最小文件大小 88 | auto-aof-rewrite-min-size 1gb 89 | 90 | # 为减少磁盘操作,暂缓重写阶段的磁盘同步 91 | no-appendfsync-on-rewrite yes 92 | 93 | # 慢查 94 | # 下面的时间单位是微秒,所以1000000就是1秒.注意,负数时间会禁用慢查询日志,而0则会强制记录所有命令. 95 | slowlog-log-slower-than 10000 96 | # 这个长度没有限制.只要有足够的内存就行.你可以通过 SLOWLOG RESET 来释放内存.(注:慢查日志是在内存里) 97 | slowlog-max-len 128 98 | #<-@wjw_note: 一下是根据实际情况来填写 99 | ``` 100 | 101 | 然后把`redis_7001.conf`复制5份: `redis_7002.conf`,`redis_7003.conf`,`redis_8001.conf`,`redis_8002.conf`,`redis_8003.conf`. 102 | 103 | **修改这4处地方:** 104 | 105 | - #pid存储目录 `pidfile ./run/redis_7001.pid` 106 | - #日志存储目录: `logfile ./log/redis_7001.log` 107 | - #数据存储目录: `dir ./data/7001` 108 | - #集群节点配置文件: `cluster-config-file nodes_7001.conf` 109 | 110 | > **⚠重要:** 把文件里的端口号`7001`修改成各自的`7002,7003,8001,8002,8003` 111 | 112 | 113 | 114 | **制作启动配置文件** 115 | 116 | 创建启动脚本:`cluster_start.bat` 117 | 118 | ```bash 119 | REM 进入当前批处理文件所在的目录 120 | cd /d %~dp0 121 | 122 | redis-server.exe ./conf/redis_7001.conf 123 | redis-server.exe ./conf/redis_8001.conf 124 | 125 | redis-server.exe ./conf/redis_7002.conf 126 | redis-server.exe ./conf/redis_8002.conf 127 | 128 | redis-server.exe ./conf/redis_7003.conf 129 | redis-server.exe ./conf/redis_8003.conf 130 | ``` 131 | 132 | 133 | 134 | 创建关闭脚本:`cluster_shutdown.bat` 135 | 136 | ```bash 137 | REM 进入当前批处理文件所在的目录 138 | cd /d %~dp0 139 | 140 | redis-cli.exe -h localhost -p 7001 shutdown 141 | redis-cli.exe -h localhost -p 8001 shutdown 142 | 143 | redis-cli.exe -h localhost -p 7002 shutdown 144 | redis-cli.exe -h localhost -p 8002 shutdown 145 | 146 | redis-cli.exe -h localhost -p 7003 shutdown 147 | redis-cli.exe -h localhost -p 8003 shutdown 148 | ``` 149 | 150 | # Redis集群 151 | 152 | **1、创建集群** 153 | 154 | 用以下命令创建集群,`--cluster-replicas 1` 参数表示希望每个主服务器都有一个从服务器,这里则代表3主3从,前3个代表3个master,后3个代表3个slave。 155 | 156 | 输入: 157 | ```bash 158 | redis-cli.exe --cluster create 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:8001 127.0.0.1:8002 127.0.0.1:8003 --cluster-replicas 1 159 | ``` 160 | 161 | > 通过该方式创建的带有从节点的机器不能够自己手动指定主节点,redis集群会尽量把主从服务器分配在不同机 器上。 162 | 163 | 输出如下: 164 | 165 | ``` 166 | >>> Performing hash slots allocation on 6 nodes... 167 | Master[0] -> Slots 0 - 5460 168 | Master[1] -> Slots 5461 - 10922 169 | Master[2] -> Slots 10923 - 16383 170 | Adding replica 127.0.0.1:8002 to 127.0.0.1:7001 171 | Adding replica 127.0.0.1:8003 to 127.0.0.1:7002 172 | Adding replica 127.0.0.1:8001 to 127.0.0.1:7003 173 | >>> Trying to optimize slaves allocation for anti-affinity 174 | [WARNING] Some slaves are in the same host as their master 175 | M: 75bbb16501a9ea766a35463b0a2a19fdb58f1ab3 127.0.0.1:7001 176 | slots:[0-5460] (5461 slots) master 177 | M: 15f947ab6196a0c770f57b66e6fe82fa1546e5ae 127.0.0.1:7002 178 | slots:[5461-10922] (5462 slots) master 179 | M: fa1df2b31ab26d65ac61a3d7c26dd9555ced394c 127.0.0.1:7003 180 | slots:[10923-16383] (5461 slots) master 181 | S: 12b22cafc02d9e460007042e9cd7f600185cf68c 127.0.0.1:8001 182 | replicates 75bbb16501a9ea766a35463b0a2a19fdb58f1ab3 183 | S: 473f8fd14ba88e4d90a692f074809179b6baa487 127.0.0.1:8002 184 | replicates 15f947ab6196a0c770f57b66e6fe82fa1546e5ae 185 | S: 7c539803fa16f9303b1c158ee216bf539cf9e626 127.0.0.1:8003 186 | replicates fa1df2b31ab26d65ac61a3d7c26dd9555ced394c 187 | Can I set the above configuration? (type 'yes' to accept): yes 188 | >>> Nodes configuration updated 189 | >>> Assign a different config epoch to each node 190 | >>> Sending CLUSTER MEET messages to join the cluster 191 | Waiting for the cluster to join 192 | . 193 | >>> Performing Cluster Check (using node 127.0.0.1:7001) 194 | M: 75bbb16501a9ea766a35463b0a2a19fdb58f1ab3 127.0.0.1:7001 195 | slots:[0-5460] (5461 slots) master 196 | 1 additional replica(s) 197 | M: 15f947ab6196a0c770f57b66e6fe82fa1546e5ae 127.0.0.1:7002 198 | slots:[5461-10922] (5462 slots) master 199 | 1 additional replica(s) 200 | S: 473f8fd14ba88e4d90a692f074809179b6baa487 127.0.0.1:8002 201 | slots: (0 slots) slave 202 | replicates 15f947ab6196a0c770f57b66e6fe82fa1546e5ae 203 | S: 7c539803fa16f9303b1c158ee216bf539cf9e626 127.0.0.1:8003 204 | slots: (0 slots) slave 205 | replicates fa1df2b31ab26d65ac61a3d7c26dd9555ced394c 206 | S: 12b22cafc02d9e460007042e9cd7f600185cf68c 127.0.0.1:8001 207 | slots: (0 slots) slave 208 | replicates 75bbb16501a9ea766a35463b0a2a19fdb58f1ab3 209 | M: fa1df2b31ab26d65ac61a3d7c26dd9555ced394c 127.0.0.1:7003 210 | slots:[10923-16383] (5461 slots) master 211 | 1 additional replica(s) 212 | [OK] All nodes agree about slots configuration. 213 | >>> Check for open slots... 214 | >>> Check slots coverage... 215 | [OK] All 16384 slots covered. 216 | ``` 217 | 218 | > **🏷注意:** 注意看M和S,对照下集群角色表 219 | 220 | **2、查看集群状态** 221 | 222 | 输入: `redis-cli -c -h 127.0.0.1 -p 7001 cluster info` 223 | 224 | 输出: 225 | 226 | ``` 227 | cluster_state:ok 228 | cluster_slots_assigned:16384 229 | cluster_slots_ok:16384 230 | cluster_slots_pfail:0 231 | cluster_slots_fail:0 232 | cluster_known_nodes:6 233 | cluster_size:3 234 | cluster_current_epoch:6 235 | cluster_my_epoch:1 236 | cluster_stats_messages_ping_sent:170 237 | cluster_stats_messages_pong_sent:168 238 | cluster_stats_messages_sent:338 239 | cluster_stats_messages_ping_received:163 240 | cluster_stats_messages_pong_received:170 241 | cluster_stats_messages_meet_received:5 242 | cluster_stats_messages_received:338 243 | ``` 244 | 245 | **3、查看集群节点** 246 | 247 | 输入: `redis-cli -c -h 127.0.0.1 -p 7001 cluster nodes` 248 | 249 | 输出: 250 | 251 | ``` 252 | 75bbb16501a9ea766a35463b0a2a19fdb58f1ab3 127.0.0.1:7001@17001 myself,master - 0 1641630845000 1 connected 0-5460 253 | 15f947ab6196a0c770f57b66e6fe82fa1546e5ae 127.0.0.1:7002@17002 master - 0 1641630846251 2 connected 5461-10922 254 | 473f8fd14ba88e4d90a692f074809179b6baa487 127.0.0.1:8002@18002 slave 15f947ab6196a0c770f57b66e6fe82fa1546e5ae 0 1641630844063 2 connected 255 | 7c539803fa16f9303b1c158ee216bf539cf9e626 127.0.0.1:8003@18003 slave fa1df2b31ab26d65ac61a3d7c26dd9555ced394c 0 1641630845154 3 connected 256 | 12b22cafc02d9e460007042e9cd7f600185cf68c 127.0.0.1:8001@18001 slave 75bbb16501a9ea766a35463b0a2a19fdb58f1ab3 0 1641630847344 1 connected 257 | fa1df2b31ab26d65ac61a3d7c26dd9555ced394c 127.0.0.1:7003@17003 master - 0 1641630844000 3 connected 10923-16383 258 | ``` 259 | 260 | # 测试用例 261 | 262 | ``` 263 | # redis-cli -c -h 127.0.0.1 -p 7001 264 | 127.0.0.1:7001> set name node1 265 | -> Redirected to slot [5798] located at 127.0.0.1:7002 266 | OK 267 | 268 | # redis-cli -c -h 127.0.0.1 -p 7002 269 | 127.0.0.1:7002> get name 270 | "node1" 271 | ``` 272 | 273 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------