1、创建 docker 容器
######主库#####
docker run -dit \
--net hadoop-master-net \
--ip 192.168.0.202 \
--restart always \
--privileged=true \
--hostname hadoop-master-mysql_13311 \
--name hadoop-master-mysql_13311 \
-v /home/docker/software/mysql-13311/conf/:/etc/mysql/conf.d \
-v /home/docker/software/mysql-13311/data/:/var/lib/mysql \
-v /home/docker/software/mysql-13311/logs/:/logs \
-v /elasticsearch/data/mysql/:/home/ \
-v /etc/localtime:/etc/localtime \
-e TZ='Asia/Shanghai' \
-e LANG="en_US.UTF-8" \
-e MYSQL_ROOT_PASSWORD=seowen123456 \
-p 13311:3306 \
-p 23311:33060 \
mysql:latest \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_general_ci
######从库1#####
docker run -dit \
--net hadoop-slave1-net \
--ip 192.168.0.203 \
--restart always \
--privileged=true \
--hostname hadoop-slave1-mysql_13311 \
--name hadoop-slave1-mysql_13311 \
-v /home/docker/software/mysql-13311/conf/:/etc/mysql/conf.d \
-v /home/docker/software/mysql-13311/data/:/var/lib/mysql \
-v /home/docker/software/mysql-13311/logs/:/logs \
-v /elasticsearch/data/mysql/:/home/ \
-v /etc/localtime:/etc/localtime \
-e TZ='Asia/Shanghai' \
-e LANG="en_US.UTF-8" \
-e MYSQL_ROOT_PASSWORD=seowen@123456 \
-p 13311:3306 \
-p 23311:33060 \
mysql:latest \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_general_ci
######从库2#####
docker run -dit \
--net hadoop-slave2-net \
--ip 192.168.0.203 \
--restart always \
--privileged=true \
--hostname hadoop-slave2-mysql_13311 \
--name hadoop-slave2-mysql_13311 \
-v /home/docker/software/mysql-13311/conf/:/etc/mysql/conf.d \
-v /home/docker/software/mysql-13311/data/:/var/lib/mysql \
-v /home/docker/software/mysql-13311/logs/:/logs \
-v /elasticsearch/data/mysql/:/home/ \
-v /etc/localtime:/etc/localtime \
-e TZ='Asia/Shanghai' \
-e LANG="en_US.UTF-8" \
-e MYSQL_ROOT_PASSWORD=seowen@123456 \
-p 13311:3306