(一)docker redis 主从配置
1.创建文件夹
mkdir /root/data/redis/master/data
touch /root/data/redis/master/redis.conf
mkdir /root/data/redis/slave-1/data
touch /root/data/redis/slave-1/redis.conf
2.yum install redis redis-server -y 将/etc/redis.conf 复制到
修改
bind 0.0.0.0
daemonize no
requirepass 123456
appendonly yes
(从节点修改 masterauth 123456 replicaof 172.17.0.2 6379 )
3.运行容器
docker run -p 16379:6379 --name redis-master -v /root/data/redis/master/data/:/data -v /root/data/redis/master/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
docker run -p 26379:6379 --name redis-slave-1 -v /root/data/redis/slave-1/data/:/data -v /root/data/redis/slave-1/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
4.验证
docker exec -it redis-master redis-cli
role
info replication
5.验证不成功
docker exec -it redis-slave redis-cli
slaveof 172.17.0.2 6379
------------------------------docker部署
docker 搭建修改为清华源
2 yum install -y yum-utils device-mapper-persistent-data lvm2
3 yum-config-manager --add-repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
4 yum repolist
5 yum -y install docker-ce
6 systemctl start docker
7 systemctl status docker
8 docker -v
10 cat /etc/docker/daemon.json
{
"registry-mirrors":["https://mirrors.tuna.tsinghua.edu.cn/"]
}
(二)docker容器部署
docker search portainer
docker pull 6053537/portainer-ce
docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock 6053537/portainer-ce
(三)解决bin-log
1)log-bin=mysql-bin
2)set global binlog_format=ROW;
3)systemctl restart mariadb