注:此博文在博文“RHCS套件实现高可用负载均衡集群(二)”的基础上完成

实验开始前设置实验环境

target端配置——server3

[root@server3 ~]# yum install -y scsi-*
[root@server3 ~]# vim /etc/tgt/targets.conf 38 <target iqn.2008-09.com.example:server.target1>39     backing-store /dev/vdb40     initiator-address 172.25.54.141     initiator-address 172.25.54.242 </target>[root@server3 ~]# /etc/init.d/tgtd start
Starting SCSI target daemon:                               [  OK  ]
[root@server3 ~]# tgt-admin -s
Target 1: iqn.2008-09.com.example:server.target1System information:Driver: iscsiState: readyI_T nexus information:LUN information:LUN: 0Type: controllerSCSI ID: IET     00010000SCSI SN: beaf10Size: 0 MB, Block size: 1Online: YesRemovable media: NoPrevent removal: NoReadonly: NoBacking store type: nullBacking store path: NoneBacking store flags: LUN: 1Type: diskSCSI ID: IET     00010001SCSI SN: beaf11Size: 21475 MB, Block size: 512Online: YesRemovable media: NoPrevent removal: NoReadonly: NoBacking store type: rdwrBacking store path: /dev/vdbBacking store flags: Account information:ACL information:172.25.54.1172.25.54.2
[root@server3 ~]# 

initiator端配置——server1、server2

[root@server1 ~]# yum install -y iscsi-*
[root@server2 ~]# yum install -y iscsi-*

  • server1
[root@server1 ~]# iscsiadm -m discovery -t st -p 172.25.54.3
##发现 iSCSI 设备
Starting iscsid:                                           [  OK  ]
172.25.54.3:3260,1 iqn.2008-09.com.example:server.target1
[root@server1 ~]# iscsiadm -m node -l
##登录并导入 iSCSI 设备
Logging in to [iface: default, target: iqn.2008-09.com.example:server.target1, portal: 172.25.54.3,3260] (multiple)
Login to [iface: default, target: iqn.2008-09.com.example:server.target1, portal: 172.25.54.3,3260] successful.
[root@server1 ~]# fdisk -l  ##存在 /dev/sda
Disk /dev/sda: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@server1 ~]# /etc/init.d/clvmd status
clvmd (pid  1264) is running...
Clustered Volume Groups: (none)
Active clustered Logical Volumes: (none)
[root@server1 ~]# lvsLV      VG       Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convertlv_root VolGroup -wi-ao----  18.54g                                             lv_swap VolGroup -wi-ao---- 992.00m
[root@server1 ~]# 
  • server2
[root@server2 ~]# iscsiadm -m discovery -t st -p 172.25.54.3
Starting iscsid:                                           [  OK  ]
172.25.54.3:3260,1 iqn.2008-09.com.example:server.target1
[root@server2 ~]# iscsiadm -m node -l
Logging in to [iface: default, target: iqn.2008-09.com.example:server.target1, portal: 172.25.54.3,3260] (multiple)
Login to [iface: default, target: iqn.2008-09.com.example:server.target1, portal: 172.25.54.3,3260] successful.
[root@server2 ~]# cat /proc/partitions
major minor  #blocks  name252        0   20971520 vda252        1     512000 vda1252        2   20458496 vda2253        0   19439616 dm-0253        1    1015808 dm-18        0   20971520 sda
[root@server2 ~]#
LVM创建
##server1
[root@server1 ~]# pvcreate /dev/sda Physical volume "/dev/sda" successfully created
[root@server1 ~]# pvsPV         VG        Fmt  Attr PSize  PFree /dev/sda   clustervg lvm2 a--  20.00g 16.00g/dev/vda2  VolGroup  lvm2 a--  19.51g     0
[root@server1 ~]###server2
[root@server2 ~]# pvs    ##还未同步PV         VG       Fmt  Attr PSize  PFree/dev/vda2  VolGroup lvm2 a--  19.51g    0
[root@server2 ~]# pvs    ##已同步PV         VG       Fmt  Attr PSize  PFree /dev/sda            lvm2 a--  20.00g 20.00g/dev/vda2  VolGroup lvm2 a--  19.51g     0
[root@server2 ~]#
##server1
[root@server1 ~]# vgcreate clustervg /dev/sda Clustered volume group "clustervg" successfully created
[root@server1 ~]# vgsVG        #PV #LV #SN Attr   VSize  VFree VolGroup    1   2   0 wz--n- 19.51g     0 clustervg   1   1   0 wz--nc 20.00g 16.00g
[root@server1 ~]###server2
[root@server2 ~]# vgsVG        #PV #LV #SN Attr   VSize  VFree VolGroup    1   2   0 wz--n- 19.51g     0 clustervg   1   0   0 wz--nc 20.00g 20.00g
[root@server2 ~]#
##server1
[root@server1 ~]# lvcreate -L 4G -n demo clustervgLogical volume "demo" created
[root@server1 ~]# lvsLV      VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convertlv_root VolGroup  -wi-ao----  18.54g                                             lv_swap VolGroup  -wi-ao---- 992.00m                                             demo    clustervg -wi-a-----   4.00g
[root@server1 ~]# ##server2
[root@server2 ~]# lvsLV      VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convertlv_root VolGroup  -wi-ao----  18.54g                                             lv_swap VolGroup  -wi-ao---- 992.00m                                             demo    clustervg -wi-a-----   4.00g
[root@server2 ~]#
[root@server1 ~]# mkfs.ext4 /dev/clustervg/demo
[root@server1 ~]# clusvcadm -d nginx
##关闭前面实验的nginx
Local machine disabling service:nginx...Success
[root@server1 ~]# 

Mysql 测试——挂载测试
[root@server1 ~]# yum install -y mysql-server
[root@server2 ~]# yum install -y mysql-server[root@server1 ~]# ll -d /var/lib/mysql/
drwxr-xr-x 2 mysql mysql 4096 Aug  9  2013 /var/lib/mysql/
[root@server1 ~]# cd /var/lib/mysql/
[root@server1 mysql]# ls
[root@server1 mysql]# ll -d .
drwxr-xr-x 2 mysql mysql 4096 Aug  9  2013 .
[root@server1 mysql]# cd
[root@server1 ~]# mount /dev/clustervg/demo /var/lib/mysql/
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228212  16934140   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo     4128448  139256   3779480   4% /var/lib/mysql
[root@server1 ~]# ll -d /var/lib/mysql/
drwxr-xr-x 3 root root 4096 Aug  2 15:49 /var/lib/mysql/
[root@server1 ~]# chown mysql.mysql /var/lib/mysql/
[root@server1 ~]# ll -d /var/lib/mysql/
drwxr-xr-x 3 mysql mysql 4096 Aug  2 15:49 /var/lib/mysql/
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228212  16934140   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo     4128448  139256   3779480   4% /var/lib/mysql
[root@server1 ~]# /etc/init.d/mysqld start
[root@server1 ~]# cd -
/var/lib/mysql
[root@server1 mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  lost+found  mysql  mysql.sock  test
[root@server1 mysql]# /etc/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@server1 mysql]# cd
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228216  16934136   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo     4128448  160724   3758012   5% /var/lib/mysql
[root@server1 ~]# umount /var/lib/mysql/
[root@server1 ~]# [root@server2 ~]# mount /dev/clustervg/demo /var/lib/mysql/
[root@server2 ~]# ll -d /var/lib/mysql/
drwxr-xr-x 5 mysql mysql 4096 Aug  2 16:02 /var/lib/mysql/
[root@server2 ~]# cd /var/lib/mysql/
[root@server2 mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  lost+found  mysql  test
[root@server2 mysql]# /etc/init.d/mysqld start
Starting mysqld:                                           [  OK  ]
[root@server2 mysql]# /etc/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@server2 mysql]# cd
[root@server2 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1148688  17013664   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo     4128448  160724   3758012   5% /var/lib/mysql
[root@server2 ~]# umount /var/lib/mysql/
[root@server2 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1148688  17013664   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
[root@server2 ~]# 









[root@server1 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 16:13:35 2018
Member Status: QuorateMember Name                                        ID   Status------ ----                                        ---- ------server1                                                1 Online, Local, rgmanagerserver2                                                2 Online, rgmanagerService Name                              Owner (Last)                              State         ------- ----                              ----- ------                              -----         service:mysql                             server1                                   started
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228232  16934120   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo     4128448  160724   3758012   5% /var/lib/mysql
[root@server1 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.71 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+---------------------+
| Database            |
+---------------------+
| information_schema  |
| #mysql50#lost+found |
| mysql               |
| test                |
+---------------------+
4 rows in set (0.00 sec)mysql> quit
Bye
[root@server1 ~]# cd /var/lib/mysql/
[root@server1 mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  lost+found  mysql  mysql.sock  test
[root@server1 mysql]# cd
[root@server1 ~]# 

[root@server1 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 16:30:18 2018
Member Status: QuorateMember Name                                        ID   Status------ ----                                        ---- ------server1                                                1 Online, Local, rgmanagerserver2                                                2 Online, rgmanagerService Name                              Owner (Last)                              State         ------- ----                              ----- ------                              -----         service:mysql                             server1                                   stopping      ##server1 正在停止
[root@server1 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 16:30:32 2018
Member Status: QuorateMember Name                                        ID   Status------ ----                                        ---- ------server1                                                1 Online, Local, rgmanagerserver2                                                2 Online, rgmanagerService Name                              Owner (Last)                              State         ------- ----                              ----- ------                              -----         service:mysql                             server2                                   started
##server2 开始工作
[root@server1 ~]#

集群化文件系统

本地文件系统演示
[root@server2 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 17:08:17 2018
Member Status: QuorateMember Name                                        ID   Status------ ----                                        ---- ------server1                                                1 Online, rgmanagerserver2                                                2 Online, Local, rgmanagerService Name                              Owner (Last)                              State         ------- ----                              ----- ------                              -----         service:mysql                             server2                                   started
[root@server2 ~]# clusvcadm -d mysql
Local machine disabling service:mysql...Success
[root@server2 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1148744  17013608   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
[root@server2 ~]#




[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228292  16934060   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
[root@server1 ~]# lvsLV      VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convertlv_root VolGroup  -wi-ao----  18.54g                                             lv_swap VolGroup  -wi-ao---- 992.00m                                             demo    clustervg -wi-a-----   4.00g
[root@server1 ~]# mount /dev/clustervg/demo /var/lib/mysql/
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228292  16934060   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo     4128448  160724   3758012   5% /var/lib/mysql
[root@server1 ~]# vgsVG        #PV #LV #SN Attr   VSize  VFree VolGroup    1   2   0 wz--n- 19.51g     0 clustervg   1   1   0 wz--nc 20.00g 16.00g
[root@server1 ~]# [root@server2 ~]# vgsVG        #PV #LV #SN Attr   VSize  VFree VolGroup    1   2   0 wz--n- 19.51g     0 clustervg   1   1   0 wz--nc 20.00g 16.00g
[root@server2 ~]# 
[root@server1 ~]# lvextend -L +8G /dev/clustervg/demo
##逻辑卷拉伸Extending logical volume demo to 12.00 GiBLogical volume demo successfully resized
[root@server1 ~]# vgsVG        #PV #LV #SN Attr   VSize  VFreeVolGroup    1   2   0 wz--n- 19.51g    0 clustervg   1   1   0 wz--nc 20.00g 8.00g
[root@server1 ~]#[root@server2 ~]# vgsVG        #PV #LV #SN Attr   VSize  VFreeVolGroup    1   2   0 wz--n- 19.51g    0 clustervg   1   1   0 wz--nc 20.00g 8.00g
[root@server2 ~]#
[root@server2 ~]# lvsLV      VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convertlv_root VolGroup  -wi-ao----  18.54g                                             lv_swap VolGroup  -wi-ao---- 992.00m                                             demo    clustervg -wi-a-----  12.00g
[root@server2 ~]#[root@server1 ~]# lvsLV      VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convertlv_root VolGroup  -wi-ao----  18.54g                                             lv_swap VolGroup  -wi-ao---- 992.00m                                             demo    clustervg -wi-ao----  12.00g
[root@server1 ~]# 
[root@server1 ~]# resize2fs /dev/clustervg/demo
[root@server1 ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   19G  1.2G   17G   7% /
tmpfs                         499M   26M  474M   6% /dev/shm
/dev/vda1                     485M   33M  427M   8% /boot
/dev/mapper/clustervg-demo     12G  159M   12G   2% /var/lib/mysql
[root@server1 ~]#[root@server2 ~]# mount /dev/clustervg/demo /var/lib/mysql/
[root@server2 ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   19G  1.1G   17G   7% /
tmpfs                         499M   26M  474M   6% /dev/shm
/dev/vda1                     485M   33M  427M   8% /boot
/dev/mapper/clustervg-demo     12G  159M   12G   2% /var/lib/mysql
[root@server2 ~]#
[root@server1 ~]# cd /var/lib/mysql/
[root@server1 mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  lost+found  mysql  test
[root@server1 mysql]# cp /etc/passwd .
[root@server1 mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  lost+found  mysql  passwd  test
[root@server1 mysql]#[root@server2 ~]# cd /var/lib/mysql/
[root@server2 mysql]# ls
##此时会有一个错误提示
ls: cannot access passwd: Input/output error
ibdata1  ib_logfile0  ib_logfile1  lost+found  mysql  passwd  test
[root@server2 mysql]#  cd
[root@server2 ~]# umount /var/lib/mysql/
[root@server2 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1148752  17013600   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
[root@server2 ~]#[root@server1 mysql]# cd
[root@server1 ~]# umount /var/lib/mysql/
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228296  16934056   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
[root@server1 ~]#

这种方式一个文件修改后,在另一台主机上看不到更改后的内容
因为所用的文件系统是ext4,这是一种本地的文件系统,所以更改后不能同时生效
真实的生产环境中是不能用这种方式实现磁盘共享的


解决方法:使用网路文件系统gfs2

使用这种文件系统,两个initiator端要实现通信,实现通信的方法是将initiator主机加入到一个集群中
GFS2 作为 RedHat
集群文件系统采用分布式元数据和多日志方式(multiple journal),并且 RedHat 仅支持 GFS2
文件系统作为高可用性集群文件系统部署使用。因为性能问题,从 RedHat Enterprise Linux 6
开始,GFS2 不再被支持作为单节点文件系统使用。

集群化文件系统
##查看集群中的主机
[root@server1 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 17:30:23 2018
Member Status: QuorateMember Name                                        ID   Status------ ----                                        ---- ------server1                                                1 Online, Local, rgmanagerserver2                                                2 Online, rgmanagerService Name                              Owner (Last)                              State         ------- ----                              ----- ------                              -----         service:mysql                             (server2)                                 disabled
[root@server1 ~]# mkfs.gfs2 -j 3 -p lock_dlm -t tutu:mygfs2 /dev/clustervg/demo
##格式化磁盘创建文件系统
## -j 3  通常日志的存放文件个数是节点数+1
[root@server1 ~]# mount /dev/clustervg/demo /var/lib/mysql/
[root@server1 ~]# cd /var/lib/mysql/
[root@server1 mysql]# ll
total 0
[root@server1 mysql]# ll -d
drwxr-xr-x 2 root root 3864 Aug  2 17:40 .
[root@server1 mysql]# [root@server2 ~]# mount /dev/clustervg/demo /var/lib/mysql/
[root@server2 ~]# ll -d /var/lib/mysql/
drwxr-xr-x 2 root root 3864 Aug  2 17:40 /var/lib/mysql/
[root@server2 ~]# 
[root@server1 mysql]# /etc/init.d/mysqld
[root@server1 mysql]# ll -d
drwxr-xr-x 4 mysql mysql 3864 Aug  2 17:44 .
[root@server1 mysql]# ls
ibdata1  ib_logfile0  ib_logfile1  mysql  mysql.sock  test
[root@server1 mysql]#[root@server2 ~]# ll -d /var/lib/mysql/
drwxr-xr-x 4 mysql mysql 3864 Aug  2 17:44 /var/lib/mysql/
[root@server2 ~]# ls /var/lib/mysql/
ibdata1  ib_logfile0  ib_logfile1  mysql  mysql.sock  test
[root@server2 ~]# 

[root@server2 ~]# gfs2_tool sb /dev/clustervg/demo all
##配置、调试文件系统或收集有关文件系统的信息mh_magic = 0x01161970mh_type = 1mh_format = 100sb_fs_format = 1801sb_multihost_format = 1900sb_bsize = 4096sb_bsize_shift = 12no_formal_ino = 2no_addr = 23no_formal_ino = 1no_addr = 22sb_lockproto = lock_dlmsb_locktable = tutu:mygfs2uuid = b81d11be-6c2d-2841-1980-30410272190f
[root@server2 ~]# gfs2_tool journals /dev/clustervg/demo all
journal2 - 128MB
journal1 - 128MB
journal0 - 128MB
3 journal(s) found.
[root@server2 ~]# [root@server1 mysql]# /etc/init.d/mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@server1 mysql]# cd
[root@server1 ~]#
##开机自动挂载测试
[root@server1 ~]# vim /etc/fstab
[root@server1 ~]# cat /etc/fstab | tail -n 1
/dev/clustervg/demo /var/lib/mysql      gfs2    _netdev     0 0
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228304  16934048   7% /
tmpfs                           510188   31816    478372   7% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo    12581504  286520  12294984   3% /var/lib/mysql
[root@server1 ~]# umount /var/lib/mysql/
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228304  16934048   7% /
tmpfs                           510188   25656    484532   6% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
[root@server1 ~]# mount -a
[root@server1 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1228304  16934048   7% /
tmpfs                           510188   31816    478372   7% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo    12581504  286520  12294984   3% /var/lib/mysql
[root@server1 ~]#[root@server2 ~]# vim /etc/fstab
[root@server2 ~]# cat /etc/fstab | tail -n 1
/dev/clustervg/demo /var/lib/mysql      gfs2    _netdev     0 0
[root@server2 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1148760  17013592   7% /
tmpfs                           510188   31816    478372   7% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo    12581504  286520  12294984   3% /var/lib/mysql
[root@server2 ~]# mount -a
[root@server2 ~]# df
Filesystem                   1K-blocks    Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root  19134332 1148760  17013592   7% /
tmpfs                           510188   31816    478372   7% /dev/shm
/dev/vda1                       495844   33466    436778   8% /boot
/dev/mapper/clustervg-demo    12581504  286520  12294984   3% /var/lib/mysql
[root@server2 ~]#
[root@server1 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 17:54:33 2018
Member Status: QuorateMember Name                                        ID   Status------ ----                                        ---- ------server1                                                1 Online, Local, rgmanagerserver2                                                2 Online, rgmanagerService Name                              Owner (Last)                              State         ------- ----                              ----- ------                              -----         service:mysql                             (server2)                                 disabled
[root@server1 ~]# clusvcadm -e mysql
##本节点,即server1 启用 mysql 服务
Local machine trying to enable service:mysql...Success
service:mysql is now running on server1
[root@server1 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.71 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> quit
Bye
[root@server1 ~]# clusvcadm -r mysql -m server2
## 切换节点进行 mysql 服务
Trying to relocate service:mysql to server2...Success
service:mysql is now running on server2
[root@server1 ~]# clustat
Cluster Status for tutu @ Thu Aug  2 18:06:07 2018
Member Status: QuorateMember Name                                                   ID   Status------ ----                                                   ---- ------server1                                                           1 Online, Local, rgmanagerserver2                                                           2 Online, rgmanagerService Name                                         Owner (Last)                                         State         ------- ----                                         ----- ------                                         -----         service:mysql                                        server2                                              started
[root@server1 ~]#[root@server2 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.71 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> quit
Bye
[root@server2 ~]#

RHCS套件实现高可用负载均衡集群(三)——共享存储相关推荐

  1. RHCS套件实现高可用负载均衡集群(二)——Fence设备

    注:此博文在博文"套件实现高可用负载均衡集群(一)"的基础上完成 环境: 物理机:172.25.54.250,作为fence server1:172.25.54.1 , serve ...

  2. RHCS套件实现高可用负载均衡集群(一)

    一.RHCS 什么是RHCS RHCS即 RedHat Cluster Suite ,中文意思即红帽集群套件. 红帽集群套件(RedHat Cluter Suite, RHCS)是一套综合的软件组件, ...

  3. IPVS-DR+keepalived实现高可用负载均衡集群

    IPVS-DR+keepalived高可用负载均衡集群方案前端的负载调度器采用双机热备方式,Keepalived主要用来监测RealServer的健康状态以及主负载均衡器和备份负载均衡器之间的故障转移 ...

  4. keepalive+nginx实现负载均衡高可用_超详细的LVS+keepalived+nginx实现高性能高可用负载均衡集群教程...

    概述 前面已经介绍了前两部分内容,下面主要介绍在nginx服务器方面的配置和测试整个集群是否可用. 在realserver端配置VIP 1.两台nginx服务器都要执行下面脚本: #vi /etc/r ...

  5. Linux 笔记 - 第十八章 Linux 集群之(三)Keepalived+LVS 高可用负载均衡集群

    一.前言 前两节分别介绍了 Linux 的高可用集群和负载均衡集群,也可以将这两者相结合,即 Keepalived+LVS 组成的高可用负载均衡集群,Keepalived 加入到 LVS 中的原因有以 ...

  6. Keepalived+Nginx实现高可用负载均衡集群

    转载自 https://www.cnblogs.com/mrlapulga/p/6857294.html 一 环境介绍 1.操作系统 CentOS Linux release 7.2.1511 (Co ...

  7. RabbitMQ:使用Docker构建RabbitMQ高可用负载均衡集群

    目录 一.构建RabbitMQ集群 1. 启动多个RabbitMQ节点 2. 加入集群 3. 配置镜像队列 二.HAProxy负载均衡 1. 安装HAProxy 2. 配置HAProxy 3. 启动 ...

  8. 汇总-13台虚拟机搭建一个高可用负载均衡集群架构

    要求 用13台虚拟机搭建一个高可用负载均衡集群架构出来,并运行三个站点,具体需求如下. 设计你认为合理的架构,用visio把架构图画出来 搭建lnmp.tomcat+jdk环境 三个站点分别为:dis ...

  9. RHCS套件的高可用负载均衡和本地数据存储

    一  高可用负载均衡 1. 在server1和server4端安装nginx,并建立用户nginx,在/etc/secuirty/limit.conf中设定限制,usr/local/nginx/con ...

最新文章

  1. centos 7 部署k8s集群
  2. 神经网络可解释性的另一种方法:积分梯度,解决梯度饱和缺陷
  3. angular2初入眼帘之-搭个环境
  4. html 文件路径 d files,tmpfiles.d
  5. Android开发工具之Android Studio----版本控制SVN使用(一)
  6. mysql命令查看过程内容_mysql查看存储过程命令
  7. 7.MongoDB与python交互
  8. ASP.NET 1.1与ASP.NET 2.0 应用运行并存
  9. PyTorch 1.0 中文官方教程:混合前端的 seq2seq 模型部署
  10. Nginx系列(4):Web服务器分析(理论上)
  11. “仁、义、礼、智、信、恕、忠、孝、悌、、节、恕、勇、让”
  12. weblogic部署项目后内存溢出
  13. 微信小程序如何使用阿里巴巴矢量图标库彩色图标
  14. Nginx负载均衡配置实例详解(转发学习)留给未来需要的自己
  15. 即将创业的我转发一篇鸡汤文---采访了 10 位身价过亿的 CEO,我终于看懂了有钱人的“奋斗”
  16. 线性代数在计算机中的应用论文,论线性代数在现实生活中的应用(结课论文)
  17. 如何在自己行业内放大和增加收入
  18. Qt之QListWidget控件的应用
  19. H3C新华三 端口加入vlan命令
  20. Ubuntu重启后nvidia-smi命令报错NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver.

热门文章

  1. 【转载】ABAP自定义长文本的处理
  2. SMW0 HTML模版的形式上传文件 维护MIME类型
  3. SAP在大中华区推出SAP数字化转型教育网络平台
  4. 3、Power View—数据透视表般华丽
  5. SM01 事务代码的加锁以及解锁
  6. SAP的号码范围(number range)SNRO和SNUM自动编号工具的用法
  7. PP 关于工单领料的总结
  8. abap 如何去掉字符串前导0
  9. ERP实施中要重视物料编码的规则
  10. SAP 移动类型详解