docker-compose安装redis+nacos+nginx+mysql
redis: docker-compose.yml
version: '3'
services:
redis:
container_name: redis
image: redis:6.2.7
restart: always
ports:
- 6379:6379
volumes:
- ./data:/data
- ./conf/redis.conf:/etc/redis/redis.conf
command:
redis-server /etc/redis/redis.conf --appendonly yes
redis.conf文件
daemonize no
pidfile /data/redis-6379.pid
port 6379
tcp-backlog 65535
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
databases 16
lua-time-limit 5000
maxclients 10000
protected-mode yes
dir /data
slowlog-log-slower-than 10000
slowlog-max-len 128
maxmemory 6G
maxmemory-policy volatile-lru
save 3600 1
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump-6379.rdb"
no-appendfsync-on-rewrite yes
appendonly yes
appendfilename "appendonly-6379.aof"
appendfsync no
auto-aof-rewrite-min-size 512mb
auto-aof-rewrite-percentage 100
aof-load-truncated yes
aof-rewrite-incremental-fsync yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
latency-monitor-threshold 0
hz 10
#notify-keyspace-events Ex
#rename-command CONFIG ""
notify-keyspace-events Egx
requirepass xT9=123456
nacos: docker-compose.yml
version: '3'
services:
nacos:
image: nacos/nacos-server:v2.1.0
container_name: nacos
environment:
- PREFER_HOST_NAME=ip
- MODE=standalone
- SPRING_DATASOURCE_PLATFORM=mysql
- MYSQL_SERVICE_HOST=192.168.16.1
- MYSQL_SERVICE_PORT=3306
- MYSQL_SERVICE_USER=root
- MYSQL_SERVICE_PASSWORD=123456
- MYSQL_SERVICE_DB_NAME=nacos
- NACOS_AUTH_ENABLE=true
- NACOS_AUTH_TOKEN=TE9KamRzZ1NJZ3VxY1h2Q0RMcHE0YllTUkdrTEtwUzE=
- JVM_XMS=128M
- JVM_XMX=128M
volumes:
- ./logs:/home/nacos/logs
#- ./conf:/home/nacos/conf
ports:
- 8848:8848
restart: always
nginx: docker-compose.yml
version: '3'
services:
nginx:
image: nginx:1.24.0
container_name: nginx
restart: always
ports:
- 80:80
volumes:
- ./conf.d/default.conf:/etc/nginx/conf.d/default.conf
- ./logs:/var/log/nginx
# - ./nginx.conf:/etc/nginx/nginx.conf:rw
- ./html:/usr/share/nginx/html
mysql: docker-compose.yml
version: '3'
services:
mysql:
image: mysql:5.7
restart: always
container_name: mysql
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 123456
command:
--lower_case_table_names=1
ports:
- 3306:3306
volumes:
- /etc/localtime:/etc/localtime:ro
- ./logs:/logs
#- ./conf:/etc/mysql/conf.d
- ./custom.cnf:/etc/mysql/conf.d/custom.cnf
- ./data:/var/lib/mysql
custom.cnf文件
[mysqld]
max_connections = 4000
max_connect_errors = 6000
sql_mode = NO_AUTO_VALUE_ON_ZERO
default_authentication_plugin=mysql_native_password