Docker搭建MHA环境

MHA环境搭建

01 | 基础环境准备

# 1. 安装docker(for mac)
# 其他版本国内镜像下载 http://mirrors.ustc.edu.cn/docker-ce/
brew cask install docker
# 2. 获取centos镜像,注:不要使用OFFICIAL版本,会存在大量依赖问题
docker pull ansible/centos7-ansible
# 3. 查看镜像
docker images         
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
ansible/centos7-ansible   latest              688353a31fde        3 years ago         447MB
# 4. 启动容器
docker run -itd --privileged --name centos-mysql 688353a31fde /usr/sbin/init
# 5. 进入容器
docker exec -it centos-mysql /bin/bash 
# 6. 容器中安装基础工具
yum install wget
yum install net-tools
yum install initscripts
yum install openssh-server

02 | 安装mysql

# 1. 下载mysql RPM安装包
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
# 2. 
yum -y install mysql57-community-release-el7-10.noarch.rpm
# 3. 安装
yum -y install mysql-community-server
# 4. 启动
systemctl start mysqld.service

# 5. 重设密码
#  查看初始化密码
cat /var/log/mysqld.log |grep 'temporary password'
#  连接mysql
mysql -u root -p 
#  重设密码
set password=password('new_password')
# 7. 保存容器制作镜像 
docker stop mysql
docker commit mysql centos:mysql-57

03 | 创建Master

# 0. 查看镜像
docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
cenos                     mysql-57        
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值