RabbitMQ
docker run -d -p5671:5671 -p5672:5672 \
--hostname=rabbitmqhost \
--restart=always \
-p15672:15672 \
-p15671:15671 \
-p25672:25672 \
--name rabbitmq \
-e RABBITMQ_DEFAULT_USER=yiding \
-e RABBITMQ_DEFAULT_PASS=yiding \
-v rabbitmq-data:/var/rabbitmq/lib \
registry.cn-hangzhou.aliyuncs.com/sherry/rabbitmq:3.7-management
MySQL
- my.cnf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
default-time-zone = '+8:00'
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
max_connections=300
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
假设文件路径为:/root/mysql/config/my.cnf
数据目录:/Users/zhangliuning/opt/volumes/mysql/data
- 启动脚本
docker run --name mysql \
-d -p 3306:3306 \
--privileged=true \
-e MYSQL_ROOT_PASSWORD=123456 \
--restart=always \
-e TZ=Asis/Shanghai \
-v /root/mysql/config/my.cnf:/etc/mysql/my.cnf \
-v mysql-data:/var/lib/mysql \
registry.cn-hangzhou.aliyuncs.com/sherry/mysql:5.7
- 查看最大连接数
show variables like '%max_connections%';
- 修改最大连接数
set GLOBAL max_connections = 200;
注意:重启后会失效,仅对当前MySQL进程有效。
Redis
docker run -d -p 6379:6379 --restart=always --name=redis registry.cn-hangzhou.aliyuncs.com/sherry/redis:5.0