docker 部署 rabbitmq redis mysql

# 安装rabbitmq
docker pull rabbitmq:management
docker run -d -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:management
# 如果需要 验证登录
docker run -d --hostname rabbit-host --name rabbitmq -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password -p 15672:15672 -p 5672:5672 rabbitmq:management
# 安装redis
docker pull redis

mkdir -p /root/docker/redis/data
mkdir -p /root/docker/redis/conf

vim /root/docker/redis/conf/redis.conf

#bind 127.0.0.1 //允许远程连接
protected-mode no appendonly yes //持久化
requirepass 123456 //密码

docker run --name myredis -p 6379:6379 -v /root/docker/redis/data:/data -v /root/docker/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf

# 验证
docker exec -it myredis redis-cli

127.0.0.1:6379> set name jfaith
127.0.0.1:6379> auth 123456
# 安装mysql
docker pull mysql:5.7
docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mysql:5.7

docker exec -it mysql bash
# 开启远程连接
mysql -u root -p"root"
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
# 开启忽略大小写
mkdir -p /root/docker/mysql/
docker cp mysql:./etc/mysql/mysql.conf.d/mysqld.cnf /root/docker/mysql/mysqld.cnf
vim /root/docker/mysql/mysqld.cnf
lower_case_table_names=1 # 最后一行新增
docker cp /root/docker/mysql/mysqld.cnf  mysql:./etc/mysql/mysql.conf.d/mysqld.cnf
# 重启
docker restart mysql

你可能感兴趣的:(docker 部署 rabbitmq redis mysql)