ClusterStorage-8-Georeplication管理灾复之配置Georeplication

本文详细介绍了在GlusterFS环境下配置Geo-Replication的步骤,包括环境检查、共享开启、密钥配置、权限设置、存储选项配置、关联配置及状态确认。通过具体命令演示了如何实现主从节点间的数据同步,并进行了任务测评,确保灾备系统的稳定运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0.实验前的环境检查与配置

[student@workstation ~]$ lab georeplication setup
 

1.开启共享

gluster volume set all cluster.enable-shared-storage enable开启共享存储功能。gluster volume list all查看存储卷情况。

[root@servera ~]# gluster volume set all cluster.enable-shared-storage enable
volume set: success

[root@servera ~]# gluster volume list all
gluster_shared_storage
mastervol
 

2.配置密钥

ssh-keygen -f ~/.ssh/id_rsa -N ''生成私钥。ssh-copy-id -i ~/.ssh/id_rsa.pub geoaccount@servere生成公钥并传递给servere的geoaccount账户。

[root@servera ~]# ssh-keygen -f ~/.ssh/id_rsa -N ''
Generating public/private rsa key pair.
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:
78:49:00:2b:c7:bb:27:c8:ee:fc:d1:22:3b:66:98:d4 root@servera.lab.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|    ...          |
|   . . .         |
|  . +   .        |
|   o . o .       |
|  . . . S        |
| o E o .         |
|.o+ = o          |
|oo+o =           |
| +=o.            |
+-----------------+

[root@servera ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub geoaccount@servere
The authenticity of host 'servere (172.25.250.14)' can't be established.
ECDSA key fingerprint is f3:3a:20:c9:5a:cc:cc:f0:44:f7:00:90:03:18:b1:8d.
Are you sure you want to continue connecting (yes/no)? yes
/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 keys
geoaccount@servere's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'geoaccount@servere'"
and check to make sure that only the key(s) you wanted were added.
 

3.配置权限

mkdir -m 0711 /var/mountbroker-root设置掩码。semanage fcontext -a -e /home /var/mountbroker-root设置安全上下文。 restorecon -Rv /var/mountbroker-root递归安全上下文。

[root@servere ~]# mkdir -m 0711 /var/mountbroker-root
[root@servere ~]# semanage fcontext -a -e /home /var/mountbroker-root
[root@servere ~]# restorecon -Rv /var/mountbroker-root
restorecon reset /var/mountbroker-root context unconfined_u:object_r:var_t:s0->unconfined_u:object_r:home_root_t:s0
 

4.配置存储选项功能

gluster system:: execute mountbroker opt mountbroker-root /var/mountbroker-root将mountbroker-root指定目录/var/mountbroker-root。gluster system:: execute mountbroker user geoaccount slavevol设置用户geoaccount。gluster system:: execute mountbroker opt geo-replication-log-group geogroup设置组。gluster system:: execute mountbroker opt rpc-auth-allow-insecure on开启特定规则定义功能。systemctl restart glusterd重启服务。

[root@servere ~]# gluster system:: execute mountbroker opt mountbroker-root /var/mountbroker-root
Command executed successfully.

[root@servere ~]# gluster system:: execute mountbroker user geoaccount slavevol
Command executed successfully.
[root@servere ~]# gluster system:: execute mountbroker opt geo-replication-log-group geogroup
Command executed successfully.
[root@servere ~]# gluster system:: execute mountbroker opt rpc-auth-allow-insecure on
Command executed successfully.
[root@servere ~]# systemctl restart glusterd
 

5.配置关联

gluster system:: execute gsec_create创建在节点之间使用的密钥对。gluster volume geo-replication mastervol geoaccount@servere::slavevol create push-pem推送密钥。/usr/libexec/glusterfs/set_geo_rep_pem_keys.sh geoaccount mastervol slavevol移动密钥到指定位置。gluster volume geo-replication mastervol geoaccount@servere::slavevol config use_meta_volume true确认主从节点之间的连接。gluster volume geo-replication mastervol geoaccount@servere::slavevol start启动主从节点之间的服务。

[root@servera ~]# gluster system:: execute gsec_create
Common secret pub file present at /var/lib/glusterd/geo-replication/common_secret.pem.pub
[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol create push-pem
Creating geo-replication session between mastervol & geoaccount@servere::slavevol has been successful
[root@servere ~]# /usr/libexec/glusterfs/set_geo_rep_pem_keys.sh geoaccount mastervol slavevol
Successfully copied file.
Command executed successfully.
You have mail in /var/spool/mail/root
[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol config use_meta_volume true
geo-replication config updated successfully
[root@servera ~]# gluster volume geo-replication mastervol geoaccount@servere::slavevol start
Starting geo-replication session between mastervol & geoaccount@servere::slavevol has been successful
 

6.状态确认

gluster volume geo-replication status确认主从节点的状态信息。ls /bricks/brick-e1/brick | tail -5查看文件同步信息。

[root@servera ~]# gluster volume geo-replication status
 
MASTER NODE                MASTER VOL    MASTER BRICK              SLAVE USER    SLAVE                                 SLAVE NODE    STATUS     CRAWL STATUS    LAST_SYNCED          
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
servera.lab.example.com    mastervol     /bricks/brick-a1/brick    geoaccount    ssh://geoaccount@servere::slavevol    servere       Active     Hybrid Crawl    N/A                  
serverb.lab.example.com    mastervol     /bricks/brick-b1/brick    geoaccount    ssh://geoaccount@servere::slavevol    servere       Passive    N/A             N/A     

[root@servere ~]# ls /bricks/brick-e1/brick | tail -5
file95
file96
file97
file98
file99
 

7.任务测评

lab georeplication grade进行测评。主要是测评主节点的副本信息状态和灾复系统的用户信息。

[student@workstation ~]$ lab georeplication grade

Grading the student's work:

 · Checking replication status for mastervol...................  PASS
 · Checking user for geo-replication...........................  PASS

Overall lab grade..............................................  PASS
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值