├── .gitignore ├── LICENSE ├── README.md ├── assets ├── adminer.jpg ├── es_01.jpg ├── es_02.jpg └── kibana.jpg ├── base ├── etc │ ├── elasticsearch │ │ └── config │ │ │ └── elasticsearch.yml │ ├── mysql │ │ └── conf.d │ │ │ └── my.conf │ └── redis │ │ ├── redis-server.post-down.d │ │ └── 00_example │ │ ├── redis-server.post-up.d │ │ └── 00_example │ │ ├── redis-server.pre-down.d │ │ └── 00_example │ │ ├── redis-server.pre-up.d │ │ └── 00_example │ │ └── redis.conf └── usr │ └── share │ └── zoneinfo │ └── Asia │ └── Shanghai ├── docker-compose.yml └── log └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | *.log 4 | .vscode 5 | *.pyc 6 | *.log* 7 | *.sublime-project 8 | *.sublime-workspace 9 | *.iml 10 | .vscode 11 | *.swp 12 | *.swo 13 | 14 | 15 | data/ 16 | base/var/* 17 | base/data0/www/htdocs 18 | base/data0/www/* 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Aphasia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 基于 Docker 的前端高可用开发环境 2 | 3 | ## 拉取代码 4 | 5 | ```bash 6 | mkdir -p ~/www/fee-docker 7 | git clone https://github.com/alphawq/Fee-dev-docker.git ~/www/fee-docker 8 | ``` 9 | 10 | # 当前支持环境 & 配置 11 | 12 | - 服务地址均为 `127.0.0.1` 13 | 14 | ``` 15 | Redis-4.0 => 端口号: 6379 16 | Memcache-1.5 => 端口号: 11211 17 | MongoDB-4.0 => 端口号: 27017 18 | Adminer-latest => 端口号: 8080 19 | MySQL-5.7 => 端口号: 3306 20 | 账号: root 21 | 密码: 123456 22 | 默认数据库: fe_dev 23 | ElasticSearch-6.6.2 => 端口号: 9200 24 | Kibana-6.6.2 => 端口号: 5601 (启动较慢,如有需要的话,可以在`compose.yml`中启用相关配置,默认关闭) 25 | ``` 26 | 27 | ## 使用`adminer`管理`mysql` 28 | 29 | - 服务器:`dev_local_mysql` 30 | - 用户名: `root` 31 | - 密码:`123456` 32 | 33 | ![adminer](./assets/adminer.jpg) 34 | 35 | ## 使用插件连接 ES 集群 36 | 37 | - [Elasticvue](https://chrome.google.com/webstore/detail/elasticvue/hkedbapjpblbodpgbajblpnlpenaebaa) 38 | - 测试连接 39 | ![es_01](./assets/es_01.jpg) 40 | - 连接成功 41 | ![es_02](./assets/es_02.jpg) 42 | - [ElasticSearch Head](https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm) 43 | 44 | ## 使用`Kibana`管理集群 (可选) 45 | 46 | Kibana 初始化连接时间较长,可以通过`docker log [Kibana Container Name]`的命令形式来查看是否启动并成功连接`ES` 47 | 48 | - 服务地址:`127.0.0.1:5601` 49 | 50 | ![kibana](./assets/kibana.jpg) 51 | 52 | # 部署 53 | 54 | ## 安装 Docker 55 | 56 | 具体安装步骤参见: 57 | 58 | - [Mac](https://docs.docker.com/docker-for-mac/install/) 59 | - [Windows](https://docs.docker.com/docker-for-windows/install/) 60 | 61 | ## 安装成功后,启动服务 62 | 63 | - debug 模式启动 64 | 65 | ```bash 66 | && cd ~/www/fee-docker \ 67 | && docker-compose build \ 68 | && echo '构建成功, 自动启动服务' \ 69 | && docker-compose up 70 | ``` 71 | 72 | - 服务方式启动 73 | 74 | ```bash 75 | docker-compose -f ~/www/fee-docker/docker-compose.yml up -d 76 | // 或 77 | cd ~/www/fee-docker && docker-compose up -d 78 | ``` 79 | 80 | # 查看容器运行状态 81 | 82 | - docker ps 83 | - docker logs [container NAME] 84 | - docker run 85 | -------------------------------------------------------------------------------- /assets/adminer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphawq/Fee-dev-docker/7b8ecfe982d2b5281fdd94410ba3cf26c9d76167/assets/adminer.jpg -------------------------------------------------------------------------------- /assets/es_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphawq/Fee-dev-docker/7b8ecfe982d2b5281fdd94410ba3cf26c9d76167/assets/es_01.jpg -------------------------------------------------------------------------------- /assets/es_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphawq/Fee-dev-docker/7b8ecfe982d2b5281fdd94410ba3cf26c9d76167/assets/es_02.jpg -------------------------------------------------------------------------------- /assets/kibana.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphawq/Fee-dev-docker/7b8ecfe982d2b5281fdd94410ba3cf26c9d76167/assets/kibana.jpg -------------------------------------------------------------------------------- /base/etc/elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | cluster.name: "docker-cluster" 2 | network.host: 0.0.0.0 3 | -------------------------------------------------------------------------------- /base/etc/mysql/conf.d/my.conf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | user=mysql 3 | character-set-server=utf8 4 | default_authentication_plugin=mysql_native_password 5 | [client] 6 | default-character-set=utf8 7 | [mysql] 8 | default-character-set=utf8 -------------------------------------------------------------------------------- /base/etc/redis/redis-server.post-down.d/00_example: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Example script executed after redis-server has stopped. 4 | # 5 | # All executable files within this directory are executed in lexical sort 6 | # order. Filenames must consist entirely of ASCII upper- and lower-case 7 | # letters, digits, underscores, and hyphens. If the script returns with a 8 | # non-zero exit code, no further scripts are run. 9 | # 10 | # Scripts are run by the 'redis' user and associated run-time environment. 11 | # 12 | # Example: 13 | # 14 | # redis-cli SCRIPT LOAD "$(cat /path/to/script.lua)" >/dev/null 15 | # 16 | # Scripts should be idempotent so that multiple calls to (eg.) 17 | # "/etc/init.d/redis-server start" does not result in unintended consequences. 18 | 19 | set -eu 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /base/etc/redis/redis-server.post-up.d/00_example: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Example script executed after redis-server has started. 4 | # 5 | # All executable files within this directory are executed in lexical sort 6 | # order. Filenames must consist entirely of ASCII upper- and lower-case 7 | # letters, digits, underscores, and hyphens. If the script returns with a 8 | # non-zero exit code, no further scripts are run. 9 | # 10 | # Scripts are run by the 'redis' user and associated run-time environment. 11 | # 12 | # Example: 13 | # 14 | # redis-cli SCRIPT LOAD "$(cat /path/to/script.lua)" >/dev/null 15 | # 16 | # Scripts should be idempotent so that multiple calls to (eg.) 17 | # "/etc/init.d/redis-server start" does not result in unintended consequences. 18 | 19 | set -eu 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /base/etc/redis/redis-server.pre-down.d/00_example: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Example script executed before redis-server is stopped. 4 | # 5 | # All executable files within this directory are executed in lexical sort 6 | # order. Filenames must consist entirely of ASCII upper- and lower-case 7 | # letters, digits, underscores, and hyphens. If the script returns with a 8 | # non-zero exit code, no further scripts are run. 9 | # 10 | # Scripts are run by the 'redis' user and associated run-time environment. 11 | # 12 | # Example: 13 | # 14 | # redis-cli SCRIPT LOAD "$(cat /path/to/script.lua)" >/dev/null 15 | # 16 | # Scripts should be idempotent so that multiple calls to (eg.) 17 | # "/etc/init.d/redis-server start" does not result in unintended consequences. 18 | 19 | set -eu 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /base/etc/redis/redis-server.pre-up.d/00_example: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Example script executed before redis-server is started. 4 | # 5 | # All executable files within this directory are executed in lexical sort 6 | # order. Filenames must consist entirely of ASCII upper- and lower-case 7 | # letters, digits, underscores, and hyphens. If the script returns with a 8 | # non-zero exit code, no further scripts are run. 9 | # 10 | # Scripts are run by the 'redis' user and associated run-time environment. 11 | # 12 | # Example: 13 | # 14 | # redis-cli SCRIPT LOAD "$(cat /path/to/script.lua)" >/dev/null 15 | # 16 | # Scripts should be idempotent so that multiple calls to (eg.) 17 | # "/etc/init.d/redis-server start" does not result in unintended consequences. 18 | 19 | set -eu 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /base/etc/redis/redis.conf: -------------------------------------------------------------------------------- 1 | # Redis configuration file example. 2 | # 3 | # Note that in order to read the configuration file, Redis must be 4 | # started with the file path as first argument: 5 | # 6 | # ./redis-server /path/to/redis.conf 7 | 8 | # Note on units: when memory size is needed, it is possible to specify 9 | # it in the usual form of 1k 5GB 4M and so forth: 10 | # 11 | # 1k => 1000 bytes 12 | # 1kb => 1024 bytes 13 | # 1m => 1000000 bytes 14 | # 1mb => 1024*1024 bytes 15 | # 1g => 1000000000 bytes 16 | # 1gb => 1024*1024*1024 bytes 17 | # 18 | # units are case insensitive so 1GB 1Gb 1gB are all the same. 19 | 20 | ################################## INCLUDES ################################### 21 | 22 | # Include one or more other config files here. This is useful if you 23 | # have a standard template that goes to all Redis servers but also need 24 | # to customize a few per-server settings. Include files can include 25 | # other files, so use this wisely. 26 | # 27 | # Notice option "include" won't be rewritten by command "CONFIG REWRITE" 28 | # from admin or Redis Sentinel. Since Redis always uses the last processed 29 | # line as value of a configuration directive, you'd better put includes 30 | # at the beginning of this file to avoid overwriting config change at runtime. 31 | # 32 | # If instead you are interested in using includes to override configuration 33 | # options, it is better to use include as the last line. 34 | # 35 | # include /path/to/local.conf 36 | # include /path/to/other.conf 37 | 38 | ################################ GENERAL ##################################### 39 | 40 | # By default Redis does not run as a daemon. Use 'yes' if you need it. 41 | # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. 42 | # docker中的redis需要在前台运行, 否则会自动退出 43 | daemonize no 44 | 45 | # When running daemonized, Redis writes a pid file in /var/run/redis.pid by 46 | # default. You can specify a custom pid file location here. 47 | pidfile /var/run/redis/redis-server.pid 48 | 49 | # Accept connections on the specified port, default is 6379. 50 | # If port 0 is specified Redis will not listen on a TCP socket. 51 | port 6379 52 | 53 | # TCP listen() backlog. 54 | # 55 | # In high requests-per-second environments you need an high backlog in order 56 | # to avoid slow clients connections issues. Note that the Linux kernel 57 | # will silently truncate it to the value of /proc/sys/net/core/somaxconn so 58 | # make sure to raise both the value of somaxconn and tcp_max_syn_backlog 59 | # in order to get the desired effect. 60 | tcp-backlog 511 61 | 62 | # By default Redis listens for connections from all the network interfaces 63 | # available on the server. It is possible to listen to just one or multiple 64 | # interfaces using the "bind" configuration directive, followed by one or 65 | # more IP addresses. 66 | # 67 | # Examples: 68 | # 69 | # bind 192.168.1.100 10.0.0.1 70 | bind 0.0.0.0 71 | 72 | # Specify the path for the Unix socket that will be used to listen for 73 | # incoming connections. There is no default, so Redis will not listen 74 | # on a unix socket when not specified. 75 | # 76 | # unixsocket /var/run/redis/redis.sock 77 | # unixsocketperm 700 78 | 79 | # Close the connection after a client is idle for N seconds (0 to disable) 80 | timeout 0 81 | 82 | # TCP keepalive. 83 | # 84 | # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence 85 | # of communication. This is useful for two reasons: 86 | # 87 | # 1) Detect dead peers. 88 | # 2) Take the connection alive from the point of view of network 89 | # equipment in the middle. 90 | # 91 | # On Linux, the specified value (in seconds) is the period used to send ACKs. 92 | # Note that to close the connection the double of the time is needed. 93 | # On other kernels the period depends on the kernel configuration. 94 | # 95 | # A reasonable value for this option is 60 seconds. 96 | tcp-keepalive 0 97 | 98 | # Specify the server verbosity level. 99 | # This can be one of: 100 | # debug (a lot of information, useful for development/testing) 101 | # verbose (many rarely useful info, but not a mess like the debug level) 102 | # notice (moderately verbose, what you want in production probably) 103 | # warning (only very important / critical messages are logged) 104 | loglevel notice 105 | 106 | # Specify the log file name. Also the empty string can be used to force 107 | # Redis to log on the standard output. Note that if you use standard 108 | # output for logging but daemonize, logs will be sent to /dev/null 109 | logfile /var/log/redis/redis-server.log 110 | 111 | # To enable logging to the system logger, just set 'syslog-enabled' to yes, 112 | # and optionally update the other syslog parameters to suit your needs. 113 | # syslog-enabled no 114 | 115 | # Specify the syslog identity. 116 | # syslog-ident redis 117 | 118 | # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. 119 | # syslog-facility local0 120 | 121 | # Set the number of databases. The default database is DB 0, you can select 122 | # a different one on a per-connection basis using SELECT where 123 | # dbid is a number between 0 and 'databases'-1 124 | databases 16 125 | 126 | ################################ SNAPSHOTTING ################################ 127 | # 128 | # Save the DB on disk: 129 | # 130 | # save 131 | # 132 | # Will save the DB if both the given number of seconds and the given 133 | # number of write operations against the DB occurred. 134 | # 135 | # In the example below the behaviour will be to save: 136 | # after 900 sec (15 min) if at least 1 key changed 137 | # after 300 sec (5 min) if at least 10 keys changed 138 | # after 60 sec if at least 10000 keys changed 139 | # 140 | # Note: you can disable saving completely by commenting out all "save" lines. 141 | # 142 | # It is also possible to remove all the previously configured save 143 | # points by adding a save directive with a single empty string argument 144 | # like in the following example: 145 | # 146 | # save "" 147 | 148 | save 900 1 149 | save 300 10 150 | save 60 10000 151 | 152 | # By default Redis will stop accepting writes if RDB snapshots are enabled 153 | # (at least one save point) and the latest background save failed. 154 | # This will make the user aware (in a hard way) that data is not persisting 155 | # on disk properly, otherwise chances are that no one will notice and some 156 | # disaster will happen. 157 | # 158 | # If the background saving process will start working again Redis will 159 | # automatically allow writes again. 160 | # 161 | # However if you have setup your proper monitoring of the Redis server 162 | # and persistence, you may want to disable this feature so that Redis will 163 | # continue to work as usual even if there are problems with disk, 164 | # permissions, and so forth. 165 | stop-writes-on-bgsave-error yes 166 | 167 | # Compress string objects using LZF when dump .rdb databases? 168 | # For default that's set to 'yes' as it's almost always a win. 169 | # If you want to save some CPU in the saving child set it to 'no' but 170 | # the dataset will likely be bigger if you have compressible values or keys. 171 | rdbcompression yes 172 | 173 | # Since version 5 of RDB a CRC64 checksum is placed at the end of the file. 174 | # This makes the format more resistant to corruption but there is a performance 175 | # hit to pay (around 10%) when saving and loading RDB files, so you can disable it 176 | # for maximum performances. 177 | # 178 | # RDB files created with checksum disabled have a checksum of zero that will 179 | # tell the loading code to skip the check. 180 | rdbchecksum yes 181 | 182 | # The filename where to dump the DB 183 | dbfilename dump.rdb 184 | 185 | # The working directory. 186 | # 187 | # The DB will be written inside this directory, with the filename specified 188 | # above using the 'dbfilename' configuration directive. 189 | # 190 | # The Append Only File will also be created inside this directory. 191 | # 192 | # Note that you must specify a directory here, not a file name. 193 | dir /var/lib/redis 194 | 195 | ################################# REPLICATION ################################# 196 | 197 | # Master-Slave replication. Use slaveof to make a Redis instance a copy of 198 | # another Redis server. A few things to understand ASAP about Redis replication. 199 | # 200 | # 1) Redis replication is asynchronous, but you can configure a master to 201 | # stop accepting writes if it appears to be not connected with at least 202 | # a given number of slaves. 203 | # 2) Redis slaves are able to perform a partial resynchronization with the 204 | # master if the replication link is lost for a relatively small amount of 205 | # time. You may want to configure the replication backlog size (see the next 206 | # sections of this file) with a sensible value depending on your needs. 207 | # 3) Replication is automatic and does not need user intervention. After a 208 | # network partition slaves automatically try to reconnect to masters 209 | # and resynchronize with them. 210 | # 211 | # slaveof 212 | 213 | # If the master is password protected (using the "requirepass" configuration 214 | # directive below) it is possible to tell the slave to authenticate before 215 | # starting the replication synchronization process, otherwise the master will 216 | # refuse the slave request. 217 | # 218 | # masterauth 219 | 220 | # When a slave loses its connection with the master, or when the replication 221 | # is still in progress, the slave can act in two different ways: 222 | # 223 | # 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will 224 | # still reply to client requests, possibly with out of date data, or the 225 | # data set may just be empty if this is the first synchronization. 226 | # 227 | # 2) if slave-serve-stale-data is set to 'no' the slave will reply with 228 | # an error "SYNC with master in progress" to all the kind of commands 229 | # but to INFO and SLAVEOF. 230 | # 231 | slave-serve-stale-data yes 232 | 233 | # You can configure a slave instance to accept writes or not. Writing against 234 | # a slave instance may be useful to store some ephemeral data (because data 235 | # written on a slave will be easily deleted after resync with the master) but 236 | # may also cause problems if clients are writing to it because of a 237 | # misconfiguration. 238 | # 239 | # Since Redis 2.6 by default slaves are read-only. 240 | # 241 | # Note: read only slaves are not designed to be exposed to untrusted clients 242 | # on the internet. It's just a protection layer against misuse of the instance. 243 | # Still a read only slave exports by default all the administrative commands 244 | # such as CONFIG, DEBUG, and so forth. To a limited extent you can improve 245 | # security of read only slaves using 'rename-command' to shadow all the 246 | # administrative / dangerous commands. 247 | slave-read-only yes 248 | 249 | # Replication SYNC strategy: disk or socket. 250 | # 251 | # ------------------------------------------------------- 252 | # WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY 253 | # ------------------------------------------------------- 254 | # 255 | # New slaves and reconnecting slaves that are not able to continue the replication 256 | # process just receiving differences, need to do what is called a "full 257 | # synchronization". An RDB file is transmitted from the master to the slaves. 258 | # The transmission can happen in two different ways: 259 | # 260 | # 1) Disk-backed: The Redis master creates a new process that writes the RDB 261 | # file on disk. Later the file is transferred by the parent 262 | # process to the slaves incrementally. 263 | # 2) Diskless: The Redis master creates a new process that directly writes the 264 | # RDB file to slave sockets, without touching the disk at all. 265 | # 266 | # With disk-backed replication, while the RDB file is generated, more slaves 267 | # can be queued and served with the RDB file as soon as the current child producing 268 | # the RDB file finishes its work. With diskless replication instead once 269 | # the transfer starts, new slaves arriving will be queued and a new transfer 270 | # will start when the current one terminates. 271 | # 272 | # When diskless replication is used, the master waits a configurable amount of 273 | # time (in seconds) before starting the transfer in the hope that multiple slaves 274 | # will arrive and the transfer can be parallelized. 275 | # 276 | # With slow disks and fast (large bandwidth) networks, diskless replication 277 | # works better. 278 | repl-diskless-sync no 279 | 280 | # When diskless replication is enabled, it is possible to configure the delay 281 | # the server waits in order to spawn the child that transfers the RDB via socket 282 | # to the slaves. 283 | # 284 | # This is important since once the transfer starts, it is not possible to serve 285 | # new slaves arriving, that will be queued for the next RDB transfer, so the server 286 | # waits a delay in order to let more slaves arrive. 287 | # 288 | # The delay is specified in seconds, and by default is 5 seconds. To disable 289 | # it entirely just set it to 0 seconds and the transfer will start ASAP. 290 | repl-diskless-sync-delay 5 291 | 292 | # Slaves send PINGs to server in a predefined interval. It's possible to change 293 | # this interval with the repl_ping_slave_period option. The default value is 10 294 | # seconds. 295 | # 296 | # repl-ping-slave-period 10 297 | 298 | # The following option sets the replication timeout for: 299 | # 300 | # 1) Bulk transfer I/O during SYNC, from the point of view of slave. 301 | # 2) Master timeout from the point of view of slaves (data, pings). 302 | # 3) Slave timeout from the point of view of masters (REPLCONF ACK pings). 303 | # 304 | # It is important to make sure that this value is greater than the value 305 | # specified for repl-ping-slave-period otherwise a timeout will be detected 306 | # every time there is low traffic between the master and the slave. 307 | # 308 | # repl-timeout 60 309 | 310 | # Disable TCP_NODELAY on the slave socket after SYNC? 311 | # 312 | # If you select "yes" Redis will use a smaller number of TCP packets and 313 | # less bandwidth to send data to slaves. But this can add a delay for 314 | # the data to appear on the slave side, up to 40 milliseconds with 315 | # Linux kernels using a default configuration. 316 | # 317 | # If you select "no" the delay for data to appear on the slave side will 318 | # be reduced but more bandwidth will be used for replication. 319 | # 320 | # By default we optimize for low latency, but in very high traffic conditions 321 | # or when the master and slaves are many hops away, turning this to "yes" may 322 | # be a good idea. 323 | repl-disable-tcp-nodelay no 324 | 325 | # Set the replication backlog size. The backlog is a buffer that accumulates 326 | # slave data when slaves are disconnected for some time, so that when a slave 327 | # wants to reconnect again, often a full resync is not needed, but a partial 328 | # resync is enough, just passing the portion of data the slave missed while 329 | # disconnected. 330 | # 331 | # The bigger the replication backlog, the longer the time the slave can be 332 | # disconnected and later be able to perform a partial resynchronization. 333 | # 334 | # The backlog is only allocated once there is at least a slave connected. 335 | # 336 | # repl-backlog-size 1mb 337 | 338 | # After a master has no longer connected slaves for some time, the backlog 339 | # will be freed. The following option configures the amount of seconds that 340 | # need to elapse, starting from the time the last slave disconnected, for 341 | # the backlog buffer to be freed. 342 | # 343 | # A value of 0 means to never release the backlog. 344 | # 345 | # repl-backlog-ttl 3600 346 | 347 | # The slave priority is an integer number published by Redis in the INFO output. 348 | # It is used by Redis Sentinel in order to select a slave to promote into a 349 | # master if the master is no longer working correctly. 350 | # 351 | # A slave with a low priority number is considered better for promotion, so 352 | # for instance if there are three slaves with priority 10, 100, 25 Sentinel will 353 | # pick the one with priority 10, that is the lowest. 354 | # 355 | # However a special priority of 0 marks the slave as not able to perform the 356 | # role of master, so a slave with priority of 0 will never be selected by 357 | # Redis Sentinel for promotion. 358 | # 359 | # By default the priority is 100. 360 | slave-priority 100 361 | 362 | # It is possible for a master to stop accepting writes if there are less than 363 | # N slaves connected, having a lag less or equal than M seconds. 364 | # 365 | # The N slaves need to be in "online" state. 366 | # 367 | # The lag in seconds, that must be <= the specified value, is calculated from 368 | # the last ping received from the slave, that is usually sent every second. 369 | # 370 | # This option does not GUARANTEE that N replicas will accept the write, but 371 | # will limit the window of exposure for lost writes in case not enough slaves 372 | # are available, to the specified number of seconds. 373 | # 374 | # For example to require at least 3 slaves with a lag <= 10 seconds use: 375 | # 376 | # min-slaves-to-write 3 377 | # min-slaves-max-lag 10 378 | # 379 | # Setting one or the other to 0 disables the feature. 380 | # 381 | # By default min-slaves-to-write is set to 0 (feature disabled) and 382 | # min-slaves-max-lag is set to 10. 383 | 384 | ################################## SECURITY ################################### 385 | 386 | # Require clients to issue AUTH before processing any other 387 | # commands. This might be useful in environments in which you do not trust 388 | # others with access to the host running redis-server. 389 | # 390 | # This should stay commented out for backward compatibility and because most 391 | # people do not need auth (e.g. they run their own servers). 392 | # 393 | # Warning: since Redis is pretty fast an outside user can try up to 394 | # 150k passwords per second against a good box. This means that you should 395 | # use a very strong password otherwise it will be very easy to break. 396 | # 397 | # requirepass foobared 398 | 399 | # Command renaming. 400 | # 401 | # It is possible to change the name of dangerous commands in a shared 402 | # environment. For instance the CONFIG command may be renamed into something 403 | # hard to guess so that it will still be available for internal-use tools 404 | # but not available for general clients. 405 | # 406 | # Example: 407 | # 408 | # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 409 | # 410 | # It is also possible to completely kill a command by renaming it into 411 | # an empty string: 412 | # 413 | # rename-command CONFIG "" 414 | # 415 | # Please note that changing the name of commands that are logged into the 416 | # AOF file or transmitted to slaves may cause problems. 417 | 418 | ################################### LIMITS #################################### 419 | 420 | # Set the max number of connected clients at the same time. By default 421 | # this limit is set to 10000 clients, however if the Redis server is not 422 | # able to configure the process file limit to allow for the specified limit 423 | # the max number of allowed clients is set to the current file limit 424 | # minus 32 (as Redis reserves a few file descriptors for internal uses). 425 | # 426 | # Once the limit is reached Redis will close all the new connections sending 427 | # an error 'max number of clients reached'. 428 | # 429 | # maxclients 10000 430 | 431 | # Don't use more memory than the specified amount of bytes. 432 | # When the memory limit is reached Redis will try to remove keys 433 | # according to the eviction policy selected (see maxmemory-policy). 434 | # 435 | # If Redis can't remove keys according to the policy, or if the policy is 436 | # set to 'noeviction', Redis will start to reply with errors to commands 437 | # that would use more memory, like SET, LPUSH, and so on, and will continue 438 | # to reply to read-only commands like GET. 439 | # 440 | # This option is usually useful when using Redis as an LRU cache, or to set 441 | # a hard memory limit for an instance (using the 'noeviction' policy). 442 | # 443 | # WARNING: If you have slaves attached to an instance with maxmemory on, 444 | # the size of the output buffers needed to feed the slaves are subtracted 445 | # from the used memory count, so that network problems / resyncs will 446 | # not trigger a loop where keys are evicted, and in turn the output 447 | # buffer of slaves is full with DELs of keys evicted triggering the deletion 448 | # of more keys, and so forth until the database is completely emptied. 449 | # 450 | # In short... if you have slaves attached it is suggested that you set a lower 451 | # limit for maxmemory so that there is some free RAM on the system for slave 452 | # output buffers (but this is not needed if the policy is 'noeviction'). 453 | # 454 | # maxmemory 455 | 456 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 457 | # is reached. You can select among five behaviors: 458 | # 459 | # volatile-lru -> remove the key with an expire set using an LRU algorithm 460 | # allkeys-lru -> remove any key according to the LRU algorithm 461 | # volatile-random -> remove a random key with an expire set 462 | # allkeys-random -> remove a random key, any key 463 | # volatile-ttl -> remove the key with the nearest expire time (minor TTL) 464 | # noeviction -> don't expire at all, just return an error on write operations 465 | # 466 | # Note: with any of the above policies, Redis will return an error on write 467 | # operations, when there are no suitable keys for eviction. 468 | # 469 | # At the date of writing these commands are: set setnx setex append 470 | # incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd 471 | # sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby 472 | # zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby 473 | # getset mset msetnx exec sort 474 | # 475 | # The default is: 476 | # 477 | # maxmemory-policy noeviction 478 | 479 | # LRU and minimal TTL algorithms are not precise algorithms but approximated 480 | # algorithms (in order to save memory), so you can tune it for speed or 481 | # accuracy. For default Redis will check five keys and pick the one that was 482 | # used less recently, you can change the sample size using the following 483 | # configuration directive. 484 | # 485 | # The default of 5 produces good enough results. 10 Approximates very closely 486 | # true LRU but costs a bit more CPU. 3 is very fast but not very accurate. 487 | # 488 | # maxmemory-samples 5 489 | 490 | ############################## APPEND ONLY MODE ############################### 491 | 492 | # By default Redis asynchronously dumps the dataset on disk. This mode is 493 | # good enough in many applications, but an issue with the Redis process or 494 | # a power outage may result into a few minutes of writes lost (depending on 495 | # the configured save points). 496 | # 497 | # The Append Only File is an alternative persistence mode that provides 498 | # much better durability. For instance using the default data fsync policy 499 | # (see later in the config file) Redis can lose just one second of writes in a 500 | # dramatic event like a server power outage, or a single write if something 501 | # wrong with the Redis process itself happens, but the operating system is 502 | # still running correctly. 503 | # 504 | # AOF and RDB persistence can be enabled at the same time without problems. 505 | # If the AOF is enabled on startup Redis will load the AOF, that is the file 506 | # with the better durability guarantees. 507 | # 508 | # Please check http://redis.io/topics/persistence for more information. 509 | 510 | appendonly no 511 | 512 | # The name of the append only file (default: "appendonly.aof") 513 | 514 | appendfilename "appendonly.aof" 515 | 516 | # The fsync() call tells the Operating System to actually write data on disk 517 | # instead of waiting for more data in the output buffer. Some OS will really flush 518 | # data on disk, some other OS will just try to do it ASAP. 519 | # 520 | # Redis supports three different modes: 521 | # 522 | # no: don't fsync, just let the OS flush the data when it wants. Faster. 523 | # always: fsync after every write to the append only log. Slow, Safest. 524 | # everysec: fsync only one time every second. Compromise. 525 | # 526 | # The default is "everysec", as that's usually the right compromise between 527 | # speed and data safety. It's up to you to understand if you can relax this to 528 | # "no" that will let the operating system flush the output buffer when 529 | # it wants, for better performances (but if you can live with the idea of 530 | # some data loss consider the default persistence mode that's snapshotting), 531 | # or on the contrary, use "always" that's very slow but a bit safer than 532 | # everysec. 533 | # 534 | # More details please check the following article: 535 | # http://antirez.com/post/redis-persistence-demystified.html 536 | # 537 | # If unsure, use "everysec". 538 | 539 | # appendfsync always 540 | appendfsync everysec 541 | # appendfsync no 542 | 543 | # When the AOF fsync policy is set to always or everysec, and a background 544 | # saving process (a background save or AOF log background rewriting) is 545 | # performing a lot of I/O against the disk, in some Linux configurations 546 | # Redis may block too long on the fsync() call. Note that there is no fix for 547 | # this currently, as even performing fsync in a different thread will block 548 | # our synchronous write(2) call. 549 | # 550 | # In order to mitigate this problem it's possible to use the following option 551 | # that will prevent fsync() from being called in the main process while a 552 | # BGSAVE or BGREWRITEAOF is in progress. 553 | # 554 | # This means that while another child is saving, the durability of Redis is 555 | # the same as "appendfsync none". In practical terms, this means that it is 556 | # possible to lose up to 30 seconds of log in the worst scenario (with the 557 | # default Linux settings). 558 | # 559 | # If you have latency problems turn this to "yes". Otherwise leave it as 560 | # "no" that is the safest pick from the point of view of durability. 561 | 562 | no-appendfsync-on-rewrite no 563 | 564 | # Automatic rewrite of the append only file. 565 | # Redis is able to automatically rewrite the log file implicitly calling 566 | # BGREWRITEAOF when the AOF log size grows by the specified percentage. 567 | # 568 | # This is how it works: Redis remembers the size of the AOF file after the 569 | # latest rewrite (if no rewrite has happened since the restart, the size of 570 | # the AOF at startup is used). 571 | # 572 | # This base size is compared to the current size. If the current size is 573 | # bigger than the specified percentage, the rewrite is triggered. Also 574 | # you need to specify a minimal size for the AOF file to be rewritten, this 575 | # is useful to avoid rewriting the AOF file even if the percentage increase 576 | # is reached but it is still pretty small. 577 | # 578 | # Specify a percentage of zero in order to disable the automatic AOF 579 | # rewrite feature. 580 | 581 | auto-aof-rewrite-percentage 100 582 | auto-aof-rewrite-min-size 64mb 583 | 584 | # An AOF file may be found to be truncated at the end during the Redis 585 | # startup process, when the AOF data gets loaded back into memory. 586 | # This may happen when the system where Redis is running 587 | # crashes, especially when an ext4 filesystem is mounted without the 588 | # data=ordered option (however this can't happen when Redis itself 589 | # crashes or aborts but the operating system still works correctly). 590 | # 591 | # Redis can either exit with an error when this happens, or load as much 592 | # data as possible (the default now) and start if the AOF file is found 593 | # to be truncated at the end. The following option controls this behavior. 594 | # 595 | # If aof-load-truncated is set to yes, a truncated AOF file is loaded and 596 | # the Redis server starts emitting a log to inform the user of the event. 597 | # Otherwise if the option is set to no, the server aborts with an error 598 | # and refuses to start. When the option is set to no, the user requires 599 | # to fix the AOF file using the "redis-check-aof" utility before to restart 600 | # the server. 601 | # 602 | # Note that if the AOF file will be found to be corrupted in the middle 603 | # the server will still exit with an error. This option only applies when 604 | # Redis will try to read more data from the AOF file but not enough bytes 605 | # will be found. 606 | aof-load-truncated yes 607 | 608 | ################################ LUA SCRIPTING ############################### 609 | 610 | # Max execution time of a Lua script in milliseconds. 611 | # 612 | # If the maximum execution time is reached Redis will log that a script is 613 | # still in execution after the maximum allowed time and will start to 614 | # reply to queries with an error. 615 | # 616 | # When a long running script exceeds the maximum execution time only the 617 | # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be 618 | # used to stop a script that did not yet called write commands. The second 619 | # is the only way to shut down the server in the case a write command was 620 | # already issued by the script but the user doesn't want to wait for the natural 621 | # termination of the script. 622 | # 623 | # Set it to 0 or a negative value for unlimited execution without warnings. 624 | lua-time-limit 5000 625 | 626 | ################################ REDIS CLUSTER ############################### 627 | # 628 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 629 | # WARNING EXPERIMENTAL: Redis Cluster is considered to be stable code, however 630 | # in order to mark it as "mature" we need to wait for a non trivial percentage 631 | # of users to deploy it in production. 632 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 633 | # 634 | # Normal Redis instances can't be part of a Redis Cluster; only nodes that are 635 | # started as cluster nodes can. In order to start a Redis instance as a 636 | # cluster node enable the cluster support uncommenting the following: 637 | # 638 | # cluster-enabled yes 639 | 640 | # Every cluster node has a cluster configuration file. This file is not 641 | # intended to be edited by hand. It is created and updated by Redis nodes. 642 | # Every Redis Cluster node requires a different cluster configuration file. 643 | # Make sure that instances running in the same system do not have 644 | # overlapping cluster configuration file names. 645 | # 646 | # cluster-config-file nodes-6379.conf 647 | 648 | # Cluster node timeout is the amount of milliseconds a node must be unreachable 649 | # for it to be considered in failure state. 650 | # Most other internal time limits are multiple of the node timeout. 651 | # 652 | # cluster-node-timeout 15000 653 | 654 | # A slave of a failing master will avoid to start a failover if its data 655 | # looks too old. 656 | # 657 | # There is no simple way for a slave to actually have a exact measure of 658 | # its "data age", so the following two checks are performed: 659 | # 660 | # 1) If there are multiple slaves able to failover, they exchange messages 661 | # in order to try to give an advantage to the slave with the best 662 | # replication offset (more data from the master processed). 663 | # Slaves will try to get their rank by offset, and apply to the start 664 | # of the failover a delay proportional to their rank. 665 | # 666 | # 2) Every single slave computes the time of the last interaction with 667 | # its master. This can be the last ping or command received (if the master 668 | # is still in the "connected" state), or the time that elapsed since the 669 | # disconnection with the master (if the replication link is currently down). 670 | # If the last interaction is too old, the slave will not try to failover 671 | # at all. 672 | # 673 | # The point "2" can be tuned by user. Specifically a slave will not perform 674 | # the failover if, since the last interaction with the master, the time 675 | # elapsed is greater than: 676 | # 677 | # (node-timeout * slave-validity-factor) + repl-ping-slave-period 678 | # 679 | # So for example if node-timeout is 30 seconds, and the slave-validity-factor 680 | # is 10, and assuming a default repl-ping-slave-period of 10 seconds, the 681 | # slave will not try to failover if it was not able to talk with the master 682 | # for longer than 310 seconds. 683 | # 684 | # A large slave-validity-factor may allow slaves with too old data to failover 685 | # a master, while a too small value may prevent the cluster from being able to 686 | # elect a slave at all. 687 | # 688 | # For maximum availability, it is possible to set the slave-validity-factor 689 | # to a value of 0, which means, that slaves will always try to failover the 690 | # master regardless of the last time they interacted with the master. 691 | # (However they'll always try to apply a delay proportional to their 692 | # offset rank). 693 | # 694 | # Zero is the only value able to guarantee that when all the partitions heal 695 | # the cluster will always be able to continue. 696 | # 697 | # cluster-slave-validity-factor 10 698 | 699 | # Cluster slaves are able to migrate to orphaned masters, that are masters 700 | # that are left without working slaves. This improves the cluster ability 701 | # to resist to failures as otherwise an orphaned master can't be failed over 702 | # in case of failure if it has no working slaves. 703 | # 704 | # Slaves migrate to orphaned masters only if there are still at least a 705 | # given number of other working slaves for their old master. This number 706 | # is the "migration barrier". A migration barrier of 1 means that a slave 707 | # will migrate only if there is at least 1 other working slave for its master 708 | # and so forth. It usually reflects the number of slaves you want for every 709 | # master in your cluster. 710 | # 711 | # Default is 1 (slaves migrate only if their masters remain with at least 712 | # one slave). To disable migration just set it to a very large value. 713 | # A value of 0 can be set but is useful only for debugging and dangerous 714 | # in production. 715 | # 716 | # cluster-migration-barrier 1 717 | 718 | # By default Redis Cluster nodes stop accepting queries if they detect there 719 | # is at least an hash slot uncovered (no available node is serving it). 720 | # This way if the cluster is partially down (for example a range of hash slots 721 | # are no longer covered) all the cluster becomes, eventually, unavailable. 722 | # It automatically returns available as soon as all the slots are covered again. 723 | # 724 | # However sometimes you want the subset of the cluster which is working, 725 | # to continue to accept queries for the part of the key space that is still 726 | # covered. In order to do so, just set the cluster-require-full-coverage 727 | # option to no. 728 | # 729 | # cluster-require-full-coverage yes 730 | 731 | # In order to setup your cluster make sure to read the documentation 732 | # available at http://redis.io web site. 733 | 734 | ################################## SLOW LOG ################################### 735 | 736 | # The Redis Slow Log is a system to log queries that exceeded a specified 737 | # execution time. The execution time does not include the I/O operations 738 | # like talking with the client, sending the reply and so forth, 739 | # but just the time needed to actually execute the command (this is the only 740 | # stage of command execution where the thread is blocked and can not serve 741 | # other requests in the meantime). 742 | # 743 | # You can configure the slow log with two parameters: one tells Redis 744 | # what is the execution time, in microseconds, to exceed in order for the 745 | # command to get logged, and the other parameter is the length of the 746 | # slow log. When a new command is logged the oldest one is removed from the 747 | # queue of logged commands. 748 | 749 | # The following time is expressed in microseconds, so 1000000 is equivalent 750 | # to one second. Note that a negative number disables the slow log, while 751 | # a value of zero forces the logging of every command. 752 | slowlog-log-slower-than 10000 753 | 754 | # There is no limit to this length. Just be aware that it will consume memory. 755 | # You can reclaim memory used by the slow log with SLOWLOG RESET. 756 | slowlog-max-len 128 757 | 758 | ################################ LATENCY MONITOR ############################## 759 | 760 | # The Redis latency monitoring subsystem samples different operations 761 | # at runtime in order to collect data related to possible sources of 762 | # latency of a Redis instance. 763 | # 764 | # Via the LATENCY command this information is available to the user that can 765 | # print graphs and obtain reports. 766 | # 767 | # The system only logs operations that were performed in a time equal or 768 | # greater than the amount of milliseconds specified via the 769 | # latency-monitor-threshold configuration directive. When its value is set 770 | # to zero, the latency monitor is turned off. 771 | # 772 | # By default latency monitoring is disabled since it is mostly not needed 773 | # if you don't have latency issues, and collecting data has a performance 774 | # impact, that while very small, can be measured under big load. Latency 775 | # monitoring can easily be enabled at runtime using the command 776 | # "CONFIG SET latency-monitor-threshold " if needed. 777 | latency-monitor-threshold 0 778 | 779 | ############################# EVENT NOTIFICATION ############################## 780 | 781 | # Redis can notify Pub/Sub clients about events happening in the key space. 782 | # This feature is documented at http://redis.io/topics/notifications 783 | # 784 | # For instance if keyspace events notification is enabled, and a client 785 | # performs a DEL operation on key "foo" stored in the Database 0, two 786 | # messages will be published via Pub/Sub: 787 | # 788 | # PUBLISH __keyspace@0__:foo del 789 | # PUBLISH __keyevent@0__:del foo 790 | # 791 | # It is possible to select the events that Redis will notify among a set 792 | # of classes. Every class is identified by a single character: 793 | # 794 | # K Keyspace events, published with __keyspace@__ prefix. 795 | # E Keyevent events, published with __keyevent@__ prefix. 796 | # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... 797 | # $ String commands 798 | # l List commands 799 | # s Set commands 800 | # h Hash commands 801 | # z Sorted set commands 802 | # x Expired events (events generated every time a key expires) 803 | # e Evicted events (events generated when a key is evicted for maxmemory) 804 | # A Alias for g$lshzxe, so that the "AKE" string means all the events. 805 | # 806 | # The "notify-keyspace-events" takes as argument a string that is composed 807 | # of zero or multiple characters. The empty string means that notifications 808 | # are disabled. 809 | # 810 | # Example: to enable list and generic events, from the point of view of the 811 | # event name, use: 812 | # 813 | # notify-keyspace-events Elg 814 | # 815 | # Example 2: to get the stream of the expired keys subscribing to channel 816 | # name __keyevent@0__:expired use: 817 | # 818 | # notify-keyspace-events Ex 819 | # 820 | # By default all notifications are disabled because most users don't need 821 | # this feature and the feature has some overhead. Note that if you don't 822 | # specify at least one of K or E, no events will be delivered. 823 | notify-keyspace-events "" 824 | 825 | ############################### ADVANCED CONFIG ############################### 826 | 827 | # Hashes are encoded using a memory efficient data structure when they have a 828 | # small number of entries, and the biggest entry does not exceed a given 829 | # threshold. These thresholds can be configured using the following directives. 830 | hash-max-ziplist-entries 512 831 | hash-max-ziplist-value 64 832 | 833 | # Similarly to hashes, small lists are also encoded in a special way in order 834 | # to save a lot of space. The special representation is only used when 835 | # you are under the following limits: 836 | list-max-ziplist-entries 512 837 | list-max-ziplist-value 64 838 | 839 | # Sets have a special encoding in just one case: when a set is composed 840 | # of just strings that happen to be integers in radix 10 in the range 841 | # of 64 bit signed integers. 842 | # The following configuration setting sets the limit in the size of the 843 | # set in order to use this special memory saving encoding. 844 | set-max-intset-entries 512 845 | 846 | # Similarly to hashes and lists, sorted sets are also specially encoded in 847 | # order to save a lot of space. This encoding is only used when the length and 848 | # elements of a sorted set are below the following limits: 849 | zset-max-ziplist-entries 128 850 | zset-max-ziplist-value 64 851 | 852 | # HyperLogLog sparse representation bytes limit. The limit includes the 853 | # 16 bytes header. When an HyperLogLog using the sparse representation crosses 854 | # this limit, it is converted into the dense representation. 855 | # 856 | # A value greater than 16000 is totally useless, since at that point the 857 | # dense representation is more memory efficient. 858 | # 859 | # The suggested value is ~ 3000 in order to have the benefits of 860 | # the space efficient encoding without slowing down too much PFADD, 861 | # which is O(N) with the sparse encoding. The value can be raised to 862 | # ~ 10000 when CPU is not a concern, but space is, and the data set is 863 | # composed of many HyperLogLogs with cardinality in the 0 - 15000 range. 864 | hll-sparse-max-bytes 3000 865 | 866 | # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in 867 | # order to help rehashing the main Redis hash table (the one mapping top-level 868 | # keys to values). The hash table implementation Redis uses (see dict.c) 869 | # performs a lazy rehashing: the more operation you run into a hash table 870 | # that is rehashing, the more rehashing "steps" are performed, so if the 871 | # server is idle the rehashing is never complete and some more memory is used 872 | # by the hash table. 873 | # 874 | # The default is to use this millisecond 10 times every second in order to 875 | # actively rehash the main dictionaries, freeing memory when possible. 876 | # 877 | # If unsure: 878 | # use "activerehashing no" if you have hard latency requirements and it is 879 | # not a good thing in your environment that Redis can reply from time to time 880 | # to queries with 2 milliseconds delay. 881 | # 882 | # use "activerehashing yes" if you don't have such hard requirements but 883 | # want to free memory asap when possible. 884 | activerehashing yes 885 | 886 | # The client output buffer limits can be used to force disconnection of clients 887 | # that are not reading data from the server fast enough for some reason (a 888 | # common reason is that a Pub/Sub client can't consume messages as fast as the 889 | # publisher can produce them). 890 | # 891 | # The limit can be set differently for the three different classes of clients: 892 | # 893 | # normal -> normal clients including MONITOR clients 894 | # slave -> slave clients 895 | # pubsub -> clients subscribed to at least one pubsub channel or pattern 896 | # 897 | # The syntax of every client-output-buffer-limit directive is the following: 898 | # 899 | # client-output-buffer-limit 900 | # 901 | # A client is immediately disconnected once the hard limit is reached, or if 902 | # the soft limit is reached and remains reached for the specified number of 903 | # seconds (continuously). 904 | # So for instance if the hard limit is 32 megabytes and the soft limit is 905 | # 16 megabytes / 10 seconds, the client will get disconnected immediately 906 | # if the size of the output buffers reach 32 megabytes, but will also get 907 | # disconnected if the client reaches 16 megabytes and continuously overcomes 908 | # the limit for 10 seconds. 909 | # 910 | # By default normal clients are not limited because they don't receive data 911 | # without asking (in a push way), but just after a request, so only 912 | # asynchronous clients may create a scenario where data is requested faster 913 | # than it can read. 914 | # 915 | # Instead there is a default limit for pubsub and slave clients, since 916 | # subscribers and slaves receive data in a push fashion. 917 | # 918 | # Both the hard or the soft limit can be disabled by setting them to zero. 919 | client-output-buffer-limit normal 0 0 0 920 | client-output-buffer-limit slave 256mb 64mb 60 921 | client-output-buffer-limit pubsub 32mb 8mb 60 922 | 923 | # Redis calls an internal function to perform many background tasks, like 924 | # closing connections of clients in timeout, purging expired keys that are 925 | # never requested, and so forth. 926 | # 927 | # Not all tasks are performed with the same frequency, but Redis checks for 928 | # tasks to perform according to the specified "hz" value. 929 | # 930 | # By default "hz" is set to 10. Raising the value will use more CPU when 931 | # Redis is idle, but at the same time will make Redis more responsive when 932 | # there are many keys expiring at the same time, and timeouts may be 933 | # handled with more precision. 934 | # 935 | # The range is between 1 and 500, however a value over 100 is usually not 936 | # a good idea. Most users should use the default of 10 and raise this up to 937 | # 100 only in environments where very low latency is required. 938 | hz 10 939 | 940 | # When a child rewrites the AOF file, if the following option is enabled 941 | # the file will be fsync-ed every 32 MB of data generated. This is useful 942 | # in order to commit the file to the disk more incrementally and avoid 943 | # big latency spikes. 944 | aof-rewrite-incremental-fsync yes 945 | -------------------------------------------------------------------------------- /base/usr/share/zoneinfo/Asia/Shanghai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphawq/Fee-dev-docker/7b8ecfe982d2b5281fdd94410ba3cf26c9d76167/base/usr/share/zoneinfo/Asia/Shanghai -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Author: alphawq@foxmail.com # 3 | ############################################################################### 4 | version: '3.1' 5 | services: 6 | dev_local_memcached: 7 | image: memcached:1.5-alpine 8 | container_name: dev_local_memcached_container 9 | volumes: 10 | # 配置时区 11 | - ./base/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime 12 | ports: 13 | - '11211:11211' 14 | dev_local_redis: 15 | image: redis:4.0-alpine 16 | container_name: dev_local_redis_container 17 | volumes: 18 | - ./base/etc/redis:/etc/redis 19 | - ./log/redis:/var/log/redis 20 | - ./base/var/lib/redis:/var/lib/redis 21 | - ./base/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime 22 | command: ['redis-server', '/etc/redis/redis.conf'] 23 | ports: 24 | - '6379:6379' 25 | dev_local_mongo: 26 | image: mongo:4.0-xenial 27 | container_name: dev_local_mongo_container 28 | volumes: 29 | - ./base/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime 30 | ports: 31 | - '27017:27017' 32 | dev_local_mysql_adminer: 33 | image: adminer 34 | container_name: dev_local_adminer_container 35 | restart: always 36 | ports: 37 | - 8080:8080 38 | dev_local_mysql: 39 | image: mysql:5.7 40 | container_name: dev_local_mysql_container 41 | volumes: 42 | - ./base/usr/share/zoneinfo/Asia/Shanghai:/etc/localtime 43 | - ./base/etc/mysql/conf.d:/etc/mysql/conf.d 44 | # 强行指定编码 45 | command: 46 | [ 47 | 'mysqld', 48 | '--character-set-server=utf8mb4', 49 | '--collation-server=utf8mb4_general_ci', 50 | ] 51 | environment: 52 | MYSQL_ROOT_PASSWORD: 123456 53 | # MYSQL_USER: 'root' 54 | MYSQL_PASSWORD: '123456' 55 | MYSQL_DATABASE: 'fe_dev' 56 | ports: 57 | - '3306:3306' 58 | dev_local_elasticsearch: 59 | image: elasticsearch:6.6.2 60 | container_name: dev_local_elasticsearch_container 61 | environment: 62 | - cluster.name=docker-cluster 63 | - bootstrap.memory_lock=true 64 | - 'ES_JAVA_OPTS=-Xms512m -Xmx512m' 65 | - discovery.zen.minimum_master_nodes=2 66 | ulimits: 67 | memlock: 68 | soft: -1 69 | hard: -1 70 | volumes: 71 | - ./data/esdata1:/usr/share/elasticsearch/data 72 | - ./base/etc/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml 73 | ports: 74 | - '9200:9200' 75 | dev_local_elasticsearch2: 76 | image: elasticsearch:6.6.2 77 | container_name: dev_local_elasticsearch2_container 78 | environment: 79 | - cluster.name=docker-cluster 80 | - bootstrap.memory_lock=true 81 | - 'ES_JAVA_OPTS=-Xms512m -Xmx512m' 82 | - discovery.zen.minimum_master_nodes=2 83 | - 'discovery.zen.ping.unicast.hosts=dev_local_elasticsearch_container' 84 | ulimits: 85 | memlock: 86 | soft: -1 87 | hard: -1 88 | volumes: 89 | - ./data/esdata2:/usr/share/elasticsearch/data 90 | - ./base/etc/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml 91 | # dev_local_kibana: 92 | # image: docker.elastic.co/kibana/kibana:6.6.2 93 | # container_name: dev_local_kibana_container 94 | # environment: 95 | # # 这个hosts的配置必须要跟ES的container_name相同才能访问 96 | # ELASTICSEARCH_HOSTS: http://dev_local_elasticsearch_container 97 | # ports: 98 | # - '5601:5601' 99 | -------------------------------------------------------------------------------- /log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphawq/Fee-dev-docker/7b8ecfe982d2b5281fdd94410ba3cf26c9d76167/log/.gitkeep --------------------------------------------------------------------------------