1、如果主节点已经运行了一段时间,且有大量数据时,如何配置并启动slave节点(写出操作步骤)
2、当master服务器宕机,提升一个slave成为新的master(写出操作步骤)
3、通过 MHA 0.58 搭建一个数据库集群结构
4、实战案例:Percona XtraDB Cluster(PXC 5.7)
5、通过 ansible 部署二进制 mysql
首先环境必须保持一致:检查操作系统,数据库版本,防火墙,selinux等
第一个题目:如果主节点已经运行了一段时间,且有大量数据时,如何配置并启动slave节点(写出操作步骤)
1、修改主节点配置文件
[root@主节点 ~]#vim /etc/my.cnf
[mysqld]
log_bin
server-id=127
gerner_log
2、重启服务
systemctl restart mariadb
MariaDB [(none)]> show master logs;
+--------------------+-----------+
| Log_name | File_size |
+--------------------+-----------+
| mariadb-bin.000001 | 330 |
+--------------------+-----------+
MariaDB [(none)]> grant replication slave on *.* to 'repluser'@'10.0.0.%' identified by 'magedu';
3、修改从节点配置文件
[root@从节点1 ~]#vim /etc/my.cnf
[client-server]
[mysqld]
server-id=110
read_only=ON
[root@从几点1 /etc/yum.repos.d]#systemctl restart mariadb
[root@从节点1~]#mysql
MariaDB [(none)]> CHANGE MASTER TO
MASTER_HOST='10.0.0.127',
MASTER_USER='repluser',
MASTER_PASSWORD='magedu',
MASTER_PORT=3306,
MASTER_LOG_FILE='mariadb-bin.000001',
MASTER_LOG_POS=330;
Query OK, 0 rows affected (0.009 sec)
MariaDB [(none)]> start slave;
4、主节点测试
MariaDB [mysql]> show processlist;
+----+-------------+------------------+-------+-------------+------+-----------------------------------------------------------------------+------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+----+-------------+------------------+-------+-------------+------+-----------------------------------------------------------------------+------------------+----------+
| 1 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 2 | system user | | NULL | Daemon | NULL | InnoDB purge coordinator | NULL | 0.000 |
| 3 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 4 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 5 | system user | | NULL | Daemon | NULL | InnoDB shutdown handler | NULL | 0.000 |
| 9 | root | localhost | mysql | Query | 0 | Init | show processlist | 0.000 |
| 10 | repluser | 10.0.0.110:45938 | NULL | Binlog Dump | 95 | Master has sent all binlog to slave; waiting for binlog to be updated | NULL | 0.000 |
+----+-------------+------------------+-------+-------------+------+-----------------------------------------------------------------------+------------------+----------+
第二个题目 :当master服务器宕机,提升一个slave成为新的master(写出操作步骤)
1、新主配置文件修改
[root@新主 ~]#vim /etc/my.cnf
[mysqld]
server=100
log-bin 打开二进制功能
systemctl restart mariadb
MariaDB [(none)]> stop slave;
MariaDB [(none)]> reset slave all ;
2、完全备份新主的数据
[root@新主 ~]#mysqldump -uroot -A -F --single-transaction --master-data=1 > /backup/fullbackup_`date +%F_%T`.sql
[root@新主 ~]#scp /backup/* 10.0.0.100: 假设还有另外一台从节点2 10.0.0.100
[root@s从节点2 ~]#vim fullbackup_2020-11-25_11\:04\:36.sql
CHANGE MASTER TO
MASTER_HOST='10.0.0.110',
MASTER_USER='repluser',
MASTER_PASSWORD='magedu',
MASTER_PORT=3306,
3、进入数据库,开启从节点
[root@s从节点2 ~]#mysql
MariaDB [(none)]> stop slave;
MariaDB [(none)]> start slave;
4、检查从节点状态是否正常
MariaDB [(none)]> show slave status\G 检查各种状态是否正常
第三个题目:通过 MHA 0.58 搭建一个数据库集群结构
一、准备三台主机
mahmanager: 10.0.0.134
master: 10.0.0.100
slave: 10.0.0.110
二、MHA配置
1、在MHA服务器做SSH-GENKEY验证,并传到各个节点
[root@mhamanager ~]#ssh-keygen
[root@mhamanager ~]#ssh-copy-id 10.0.0.134
[root@mhamanager ~]#rsync -av .ssh 10.0.0.110:/root/
[root@mhamanager ~]#rsync -av .ssh 10.0.0.100:/root/
2、在MHA服务器下载 node包和 manager包,并传给各个节点,并安装
yum -y install mha4mysql-node-0.58-0.el7.centos.noarch.rpm
yum -y install mha4mysql-manager-0.58-0.el7.centos.noarch.rpm
[root@mhamanager ~]# yum -y install mha4mysql-node-0.58-0.el7.centos.noarch.rpm
[root@mhamanager ~]# yum -y install mha4mysql-manager-0.58-0.el7.centos.noarch.rpm
[root@mhamanager ~]#scp mha4mysql-node-0.58-0.el7.centos.noarch.rpm ; mha4mysql-manager-0.58-0.el7.centos.noarch.rpm 10.0.0.100;
[root@mhamanager ~]#scp mha4mysql-node-0.58-0.el7.centos.noarch.rpm ; mha4mysql-manager-0.58-0.el7.centos.noarch.rpm 10.0.0.110:
3、创建配置文件,指定好管理用户mhauser,ssh用户,复制用户,以及认证密码。主服务器候选主机
一会在master主节点所授权的用户和密码要对应。
[root@mhamanager ~]# mkdir /etc/mastermha
[root@mhamanager ~]# vim /etc/mastermha/app1.cnf
[server default]
user=mhauser
password=magedu
manager_workdir=/data/mastermha/app1/
manager_log=/data/mastermha/app1/manager.log
remote_workdir=/data/mastermha/app1/
ssh_user=root
repl_user=repluser
repl_password=magedu
ping_interval=1
master_ip_failover_script=/usr/local/bin/master_ip_failover
report_script=/usr/local/bin/sendmail.sh
check_repl_delay=0
master_binlog_dir=/data/mysql/
[server1]
hostname=10.0.0.110
candidate_master=1
[serveer2]
hostname=10.0.0.100
candidate_master=1 主服务候选人
4、规划好MHA所需要的网卡和虚拟IP地址,网关(主服务器必须与这里对应)
[root@mhamanager ~]#vim /usr/local/bin/master_ip_failover
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use Getopt::Long;
my (
$command, $ssh_user, $orig_master_host, $orig_master_ip,
$orig_master_port, $new_master_host, $new_master_ip, $new_master_port
);
my $vip = '10.0.0.200/24'; mycat虚拟ip
my $gateway = '10.0.0.2';
my $interface = 'eth0'; #指定VIP所在网卡
my $key = "1";
my $ssh_start_vip = "/sbin/ifconfig $interface:$key $vip;/sbin/arping -I
$interface -c 3 -s $vip $gateway >/dev/null 2>&1";
my $ssh_stop_vip = "/sbin/ifconfig $interface:$key down";
GetOptions(
'command=s' => \$command,
'ssh_user=s' => \$ssh_user,
'orig_master_host=s' => \$orig_master_host,
'orig_master_ip=s' => \$orig_master_ip,
'orig_master_port=i' => \$orig_master_port,
'new_master_host=s' => \$new_master_host,
'new_master_ip=s' => \$new_master_ip,
'new_master_port=i' => \$new_master_port,
);
exit &main();
sub main {
print "\n\nIN SCRIPT TEST====$ssh_stop_vip==$ssh_start_vip===\n\n";
if ( $command eq "stop" || $command eq "stopssh" ) {
# $orig_master_host, $orig_master_ip, $orig_master_port are passed.
# If you manage master ip address at global catalog database,
# invalidate orig_master_ip here.
my $exit_code = 1;
eval {
print "Disabling the VIP on old master: $orig_master_host \n";
&stop_vip();
$exit_code = 0;
};
if ($@) {
warn "Got Error: $@\n";
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "start" ) {
# all arguments are passed.
# If you manage master ip address at global catalog database,
# activate new_master_ip here.
# You can also grant write access (create user, set read_only=0, etc) here.
my $exit_code = 10;
eval {
print "Enabling the VIP - $vip on the new master - $new_master_host \n";
&start_vip();
$exit_code = 0;
};
if ($@) {
warn $@;
exit $exit_code;
}exit $exit_code;
}elsif ( $command eq "status" ) {
print "Checking the Status of the script.. OK \n";
`ssh $ssh_user\@$orig_master_host \" $ssh_start_vip \"`;
exit 0;
}
else {
&usage();
exit 1;
}
}
# A simple system call that enable the VIP on the new master
sub start_vip() {
`ssh $ssh_user\@$new_master_host \" $ssh_start_vip \"`;
}
# A simple system call that disable the VIP on the old_master
sub stop_vip() {
`ssh $ssh_user\@$orig_master_host \" $ssh_stop_vip \"`;
}
sub usage {
print
"Usage: master_ip_failover --command=start|stop|stopssh|status --
orig_master_host=host --orig_master_ip=ip --orig_master_port=port --
new_master_host=host --new_master_ip=ip --new_master_port=port\n";
}
5、授执行权限
[root@mhamanager ~]#chmod +x /usr/local/bin/master_ip_failover
二、主节点master配置
1、创建数据库文件夹
mkdir /data/mysql
2、安装node包和MHA-manager包
[root@master ~]#yum -y install mha4mysql-node-0.58-0.el7.centos.noarch.rpm
[root@master ~]#yum -y insall mha4mysql-manager-0.58-0.el7.centos.noarch.rpm
3、下载mysql数据库包并安装
mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz (这里不做介绍,二进制安装Mysql其他路径可查看)
4、开启mysql 服务开机自启动
systemc enable --now mysqld
5、修改主配置文件
vim /etc/my.cnf
[mysqld]
server-id=1 必须唯一
general_log 开启通用日志,查询用
log-bin 二进制文件复制需要
datadir=/data/mysql 指定数据库路径
skip_name_resolve=1 禁止反解析
systemctl restart mysqld
6、查看master二进制文件名和pos
mysql> show master logs;
+--------------------+-----------+
| Log_name | File_size |
+--------------------+-----------+
| Centos8-bin.000001 | 177 |
| Centos8-bin.000002 | 10817 |
|+--------------------+-----------+
7、授权用户
mysql>grant replication slave on *.* to 'repluser'@'10.0.0.%' identified by 'magedu';
mysql> grant all on *.* to 'mhauser'@'10.0.0.%' identified by 'magedu';
mysql> grant all on *.* to 'root'@'10.0.0.%' identified by 'magedu';
8、配置虚拟网卡 (必须同管理节点manager一致)
[root@master ~]#ifconfig ens160:1 10.0.0.100/24
三、配置从节点slave
1、创建文件夹
mkdir /data/mysql
2、安装 node包
[root@slave ~]#yum -y install mha4mysql-node-0.58-0.el7.centos.noarch.rpm
[root@slave ~]#yum -y insall mha4mysql-manager-0.58-0.el7.centos.noarch.rpm
3、下载mysql数据库包并安装
[root@slave ~]#mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz (这里不做介绍,二进制安装Mysql其他路径可查看)
4、服务开机自启动
[root@slave ~]#systemc enable --now mysqld
vim /etc/my.cnf
[mysqld]
server-id=2必须唯一
read_only 禁止从节点写入
general_log 开启通用日志,查询用
log-bin 二进制文件复制需要
datadir=/data/mysql 指定数据库路径
skip_name_resolve=1 禁止反解析
5、重启服务使配置文件生效
systemctl restart mysqld
6、从节点加入主节点
mysql>CHANGE MASTER TO
MASTER_HOST='10.0.0.100',
MASTER_USER='repluser',
MASTER_PASSWORD='magedu',
MASTER_PORT=3306,
MASTER_LOG_FILE='Centos8-bin.000005',
MASTER_LOG_POS=10817;
7、开启从节点功能
mysql>start slave;
8、查看从节点的状态连接
mysql>show slave status
四、检查,并启动整个项目
1、管理节点检查各个节点的配置之间的连接是否通畅
[root@manager~]#masterha_check_ssh --conf=/etc/mastermha/app1.cnf
显示sucessful 即为正常
[root@manager ~]#/usr/bin/masterha_check_repl --conf=/etc/mastermha/app1.cnf
OK 即正常
2、启动管理节点
nohup masterha_manager --conf=/etc/mastermha/app1.cnf &> /dev/null
3、查看状态
[root@manager ~]#masterha_check_status --conf=/etc/mastermha/app1.cnf
app1 (pid:25730) is running(0:PING_OK), master:10.0.0.100
五、查看日志是否正常
[root@master ~]#tail -f /data/mysql/Centos8.log
2020-11-25T14:25:42.532944Z 33 Query SELECT 1 As Value
2020-11-25T14:25:43.534100Z 33 Query SELECT 1 As Value
2020-11-25T14:25:44.533716Z 33 Query SELECT 1 As Value
2020-11-25T14:25:45.534259Z 33 Query SELECT 1 As Value
2020-11-25T14:25:46.534906Z 33 Query SELECT 1 As Value
2020-11-25T14:25:47.537939Z 33 Query SELECT 1 As Value
2020-11-25T14:25:48.536115Z 33 Query SELECT 1 As Value
六、模拟主服务器宕机
service stop mysqld
七、查看从服务器是否升级为主节点
show slave state\G
mysql> show slave status\G
Empty set (0.00 sec) 从节点状态为空
mysql> show master status\G
*************************** 1. row ***************************
File: localhost-bin.000003
Position: 154
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
此时已经切换为新主服务器
第四题目:实战案例:Percona XtraDB Cluster(PXC 5.7)
一、准备4台centos7 的主机: (此项目对环境要求高,环境必须非常干净,否则导致服务不能启动,尤其是mysql必须先卸载干净才行)
[root@PXC-1~]#10.0.0.128
[root@PXC-2~]#10.0.0.130
[root@PXC-3~]#10.0.0.1136
[root@PXC-4~]#10.0.0.137
二、PXC-1-xtradb主机:
1、先配置 本地源
[root@PXC-1~]#10.0.0.128vim /etc/yum.repos.d/pxe.repo
[percona]
name=pecona_repo
baseurl=https://mirrors.tuna.tsinghua.edu.cn/percona/release/$releasever/RPMS/$basearch
enable=1
gpgcheck=0
2、将pxe.repo 复制到其他三台主机
scp /etc/pxe.repo 10.0.0.130/etc/yum.repos.d/
scp /etc/pxe.repo 10.0.0.136:/etc/yum.repos.d/
scp /etc/pxe.repo 10.0.0.137:/etc/yum.repos.d/
3、检查yum源,并下载安装 percona
[root@PXC-1~]#yum repolist
[root@PXC-1~]#yum -y install Percona-XtraDB-Cluster-57
4、修改wsrep.cnf文件 (添加集群所有IP,本机IP,集群名称,本机节点名称,集群公用密码账号)
[root@PXC-1~]#vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
wsrep_cluster_address=gcomm://10.0.0.128,10.0.0.130,10.0.0.136
wsrep_node_address=10.0.0.128
wsrep_cluster_name=pxc-magedu-cluster
wsrep_node_name=pxc-cluster-node-1
wsrep_sst_auth="sstuser:s3cretPass"
5、修改本机的server-id(必须保证唯一)
[root@PXC-1~]#vim /etc/percona-xtradb-cluster.conf.d/mysqld.cnf
[mysqld]
server-id=1
二、PXC-2配置两个文件
[root@PXC-2~]#vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
wsrep_cluster_address=gcomm://10.0.0.128,10.0.0.130,10.0.0.136
wsrep_node_address=10.0.0.130
wsrep_cluster_name=pxc-magedu-cluster
wsrep_node_name=pxc-cluster-node-2
wsrep_sst_auth="sstuser:s3cretPass"
[root@PXC-1~]#vim /etc/percona-xtradb-cluster.conf.d/mysqld.cnf
[mysqld]
server-id=2
二、PXC-3配置两个文件
[root@PXC-3~]#vim /etc/percona-xtradb-cluster.conf.d/wsrep.cnf
wsrep_cluster_address=gcomm://10.0.0.128,10.0.0.130,10.0.0.136
wsrep_node_address=10.0.0.136
wsrep_cluster_name=pxc-magedu-cluster
wsrep_node_name=pxc-cluster-node-3
wsrep_sst_auth="sstuser:s3cretPass"
[root@PXC-3~]#vim /etc/percona-xtradb-cluster.conf.d/mysqld.cnf
[mysqld]
server-id=3
三、启动PXC-1 修改集群配置(可指定任意一台)
[root@PXC-1~]#systemctl start mysql@bootstrap.service
1、查找本机数据库mysql的隐藏密码
[root@PXC-1~]#grep "temporary password" /var/log/mysqld.log
[Note] A temporary password is generated for root@localhost: sgyI&:gd2n2<
2、输入密码,进入数据库,更改root密码,并授权
[root@PXC-1~]#mysql -uroot -p‘sgyI&:gd2n2<'
mysql> alter user 'root'@'localhost' identified by 'magedu';
3、添加集群公用账号和口令,并授权。
mysql> grant reload, lock tables,process,replication client on *.* to 'sstuser'@'localhost' identified by 's3cretPass';
四、启动其他两个节点的数据库mysql服务
[root@PXC-1~]#systemctl start mysql
[root@PXC-2~]#systemctl start mysql
五、检查加入集群的数目为3即为正常
[root@PXC-1~]#smysql> show status like 'wsrep_cluster_size';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| wsrep_cluster_size | 3 |
+--------------------+-------+
1 row in set (0.00 sec)
mysql> show variables like 'wsrep_node_address';
+--------------------+------------+
| Variable_name | Value |
+--------------------+------------+
| wsrep_node_address | 10.0.0.128 |
+--------------------+------------+
1 row in set (0.00 sec)
mysql> show variables like 'wsrep_node_name';
+-----------------+--------------------+
| Variable_name | Value |
+-----------------+--------------------+
| wsrep_node_name | pxc-cluster-node-1 |
+-----------------+--------------------+
1 row in set (0.00 sec)
mysql> show status like 'wsrep%';
| wsrep_local_state_comment | Synced
wsrep_cluster_status | Primary
[root@PXC-1~]#ss -ntl
3306 端口号
4567 端口号
[root@PXC-2~]ss -ntl
3306 端口号
第五个题目 通过 ansible 部署二进制 mysql
一、准备工作
1准备两台主机
ansible:10.0.0.130
client:10.0.0.123
2、做好主机之间的认证权限
[root@ansible~]# ssh-keygen -t rsa -f ~/.ssh/id_rsa
[root@ansible~]#cd .ssh
authorized_keys id_rsa id_rsa.pub known_hosts
[root@ansible /.ssh]#ssh-copy-id 127.0.0.1
[root@ansible /.ssh]#scp authorized_keys 10.0.0.110:.ssh
3、准备好即将二进制安装的mysql打包文件
[root@ansible~]# mariadb-10.2.31-linux-x86_64.tar.gz
[root@ansible~]# mkdir -pv /ansible/roles/mysqld/{tasks,handlers,files}
二、配置ansible主机各种目录
1、编辑Mysql 的主配置文件
cat >/ansible/roles/mysqd/files/my.cnf << EOF
[mysqld]
server-id=1
log-bin
datadir=/data/mysql
socket=/data/mysql/mysql.sock
log-error=data/mysql/mysql.log
pid-file=/data/mysql/mysql.pid
[client]
socket=/data/mysql/mysql.sock
EOF
2、yum 安装ansible
[root@ansible~]# yum -y install ansible
3、添加各个管理节点的IP在hosts文件中
[root@ansible~]# vim /etc/ansible/hosts
[dbsrvs]
10.0.0.123 ansible_connection=local
4、修改配置文件 取消下面两项注释
[root@ansible~]# vim /etc/ansible/ansible.cfg
host_key_checking = False
log_path=/var/log/ansible.log
5、进入mysqld文件夹 编辑必须文件
[root@ansible ]# cd /ansible/roles/mysqld
[root@ansible /ansible/roles/mysqld]# vim tasks/main.yml
- include: datadir.yml
- include: install.yml
- include: group.yml
- include: user.yml
- include: package_unarchive.yml
- include:package_link.yml
- include: dir_grant.yml
- include: boot_file.yml
- include: bootaction.yml
- include: bin_link.yml
- include: config.yml
- include: data_initialization.yml
- include: mysql_server.yml
- include: mysql_service.yml
[root@ansible /ansible/roles/mysqld]# vim tasks/datadir.yml
- name: create database
command: creates=/data/mysql mkdir /data/mysql'
[root@ansible /ansible/roles/mysqld]#vim tasks/install.yml
- name: install libaio package 下载mysql依赖包libaio包
yum: name=libaio
[root@ansible /ansible/roles/mysqld]#vim tasks/group.yml
- name: cteate mysql group
group: name=mysql system=yes gid=58
[root@ansible /ansible/roles/mysqld]#vim tasks/user.yml
- name: create mysql user 创建系统服务用户Mysql
user: name=mysql system=yes shell=/sbin/nologin uid=58 group=mysql
[root@ansible /ansible/roles/mysqld]#vim tasks/package_unarchive.yml
- name: unarchive mysqld package 解压二进制压缩包
unarchive: src=mariadb-10.2.31-linux-x86_64.tar.gz dest=/usr/local/
vim tasks/package_link.yml
- name: mysql package link
file: src=/usr/local/mariadb-10.2.31-linux-x86_64 dest=/usr/local/mysql state=link
[root@ansible /ansible/roles/mysqld]#vim tasks/dir_grant.yml
- name: file grant 对软连接mysql授权为root
file: dest=/usr/local/mysql/ owner=root group=root recurse=yes
[root@ansible /ansible/roles/mysqld]#vim tasks/boot_file.yml
- name: boot file by itself 将开机自启动写成变量
copy: content=PATH=/usr/local/mysql/bin:$PATH dest=/etc/profile.d/mysql.sh
[root@ansible /ansible/roles/mysqld]#vim tasks/bootaction.yml
- name: boot action by itself 执行开机启动脚本
script: /etc/profile.d/mysql.sh
[root@ansible /ansible/roles/mysqld]#vim tasks/bin_link.yml
- name: make the file effective 执行脚本软连接
file: src=/usr/local/mysql/bin/ dest=/usr/bin/bin state=link
[root@ansible /ansible/roles/mysqld]#vim tasks/config.yml
- name: config file mysql主配置文件
copy: src=files/my.cnf dest=/etc/my.cnf
vim tasks/data_initialization.yml
- name: mysql data initialization mysql 数据库初始化,生成数据库信息
script: /usr/local/mysql/scripts/mysql_install_db --datadir=/data/mysql --user=mysql --basedir=/usr/local/mysql
[root@ansible /ansible/roles/mysqld]#vim tasks/mysql_server.yml
- name: mysql server 将mysql 服务文件复制到开机启动文件下
copy: src=/usr/local/mysql/support-files/mysql.server dest=/etc/init.d/mysqld
[root@ansible /ansible/roles/mysqld]#vim tasks/mysql_service.yml
- name: mysql service 开启mysqsl 开机自启动服务 (如果这里启动失败,则:chmod a+x /etc/init.d/mysqld 然后:/etc/init.d/mysql start 即可)
service: name=mysqld state=started enabled=yes
[root@ansible /ansible/roles/mysqld]# cd ../.. (切入ansible下,做角色启动脚本)
[root@ansible ]# vim role_mysqld.yml
---
- hosts: dbsrvs
remote_user: root
roles:
- mysqld
三、开启ansible-playbook功能
1、检查脚本是否正确
[root@ansible ]# ansible-playbook -C role_mysqld.yml
2、检查无误后执行脚本
[root@ansible ]# ansible-playbook role_mysqld.yml
PLAY RECAP *********************************************************************************************
10.0.0.123 : ok=21 changed=21 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
10.0.0.130 : ok=21 changed=21 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost /ansible]#ansible dbsrvs -a 'ss -ntl'
LISTEN 0 80 *:3306 *:*
大功告成,收笔!