2021-10-11

案例1:准备MHA集群环境
案例2:部署MHA集群案例3:测试配置1 案例1:准备MHA集群环境1.1 问题配置SSH免密登录安装依赖包配置MySQL一主多从结构1.2 方案准备5台虚拟机,角色规划如图-1所示。图-1IP规划,如图-2所示:图-21.3 步骤实现此案例需要按照如下步骤进行。步骤一: 配置ssh免密登录1)配置数据库服务器192.168.4.51[root@host51 ~]# ssh-keygen //创建秘钥对Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): //回车Enter passphrase (empty for no passphrase): //回车Enter same passphrase again:Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:qb7EZByHad3Jadr+zkiEbo7ZKGmCNlctgp+Wfp3Yad0 root@pxcnode71The key’s randomart image is:±–[RSA 2048]----+| || + o o || = o * || o o * || . = S o || . . * + o || … =.O * + ||.o.+= & o E ||. =+…B.o …+ |±—[SHA256]-----+[root@host51 ~]#[root@host51 ~]# ssh-copy-id root@192.168.4.52 //传递公钥给host52主机/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keysroot@192.168.4.71’s password: //输入host52主机系统管理员root用户密码Number of key(s) added: 1Now try logging into the machine, with: "ssh ‘root@192.168.4.52’“and check to make sure that only the key(s) you wanted were added.[root@host51 ~]#[root@host51 ~]# ssh-copy-id root@192.168.4.53 //传递公钥给host53主机/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keysroot@192.168.4.71’s password: //输入host53主机系统管理员root用户密码Number of key(s) added: 1Now try logging into the machine, with: “ssh ‘root@192.168.4.53’“and check to make sure that only the key(s) you wanted were added.[root@host51 ~]#[root@host51 ~]# ssh root@192.168.4.52 //可以无密码连接52主机Last login: Fri Jun 21 13:21:39 2019 from 192.168.4.254.-”””-./ .=. \/ 6 6 /( _/ )ooo_/__________/ | I am Virtual Host ! ! ! |______________ooo/| | || | _|| | ||||/-‘Y’-(/ __)[root@host52 ~]#[root@host52 ~]# exit //断开连接登出Connection to 192.168.4.52 closed.[root@host51 ~]#[root@host51 ~]# ssh root@192.168.4.53 //可以无密码连接52主机Last login: Fri Jun 21 09:01:15 2019 from 192.168.4.254.-"""-./ .=. \/ 6 6 /( _/ )ooo_/__________/ | I am Virtual Host ! ! ! |______________ooo/| | || | _|| | ||||/-‘Y’-(/ __)[root@host53 ~]# exit//断开连接登出Connection to 192.168.4.53 closed.[root@host51 ~]#2)配置数据库服务器192.168.4.52[root@host52 ~]# ssh-keygen //创建秘钥对Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): //回车Enter passphrase (empty for no passphrase): //回车Enter same passphrase again:Your identification has been saved in /root/.ssh/id_rsa.Your public key has been saved in /root/.ssh/id_rsa.pub.The key fingerprint is:SHA256:qb7EZByHad3Jadr+zkiEbo7ZKGmCNlctgp+Wfp3Yad0 root@pxcnode71The key’s randomart image is:±–[RSA 2048]----+| || + o o || = o * || o o * || . = S o || . . * + o || … =.O * + ||.o.+= & o E ||. =+…B.o …+ |±—[SHA256]-----+[root@host52 ~]#[root@host52 ~]# ssh-copy-id root@192.168.4.51 //传递公钥给host51主机/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keysroot@192.168.4.51’s password: //输入host51主机系统管理员root用户密码Number of key(s) added: 1Now try logging into the machine, with: "ssh ‘root@192.168.4.51’“and check to make sure that only the key(s) you wanted were added.[root@host52 ~]#[root@host52 ~]# ssh-copy-id root@192.168.4.53 //传递公钥给host53主机/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keysroot@192.168.4.53’s password: //输入host53主机系统管理员root用户密码Number of key(s) added: 1Now try logging into the machine, with: “ssh ‘root@192.168.4.53’“and check to make sure that only the key(s) you wanted were added.[root@host52 ~]#[root@host52 ~]# ssh root@192.168.4.51 //可以无密码连接51主机Last login: Fri Jun 21 13:21:39 2019 from 192.168.4.254.-”””-./ .===. \/ 6 6 /( _/ )ooo_/_______

apiVersion: v1
kind: Service
metadata:
name: service-clusterip
namespace: dev
spec:
selector:
app: nginx-pod
clusterIP: 10.99.99.99 #serviceIP 如果不写会默认生成一个
type: ClusterIP
ports:

  • port: 80 #service端口
    targetPort: 80 #pod端口
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值