CentOS5.8 cman+rgmanager+iscsi+gfs2+cLVM 实现集群共享存储
大纲一、系统环境
二、准备工作
三、配置过程
一、系统环境
系统环境
CentOS5.8 x86_64
node1.network.com node1 172.16.1.101
node2.network.com node2 172.16.1.105
node3.network.com node3 172.16.1.110
软件版本
cman-2.0.115-124.el5.x86_64.rpm
rgmanager-2.0.52-54.el5.centos.x86_64.rpm
system-config-cluster-1.0.57-17.noarch.rpm
二、准备工作
1、时间同步
1
2
3
4
5
6
7
8
9
10
# ntpdate s2c.time.edu.cn
# ntpdate s2c.time.edu.cn
# ntpdate s2c.time.edu.cn
可根据需要在每个节点上定义crontab任务
# which ntpdate
/sbin/ntpdate
# echo "*/5 * * * * /sbin/ntpdate s2c.time.edu.cn &> /dev/null" >> /var/spool/cron/root
# crontab -l
*/5 * * * * /sbin/ntpdate s2c.time.edu.cn &> /dev/null
2、主机名称要与uname -n,并通过/etc/hosts解析
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
node1
# hostname node1.network.com
# uname -n
node1.network.com
# sed -i 's@\(HOSTNAME=\).*@\1node1.network.com@g'/etc/sysconfig/network
node2
# hostname node2.network.com
# uname -n
node2.network.com
# sed -i 's@\(HOSTNAME=\).*@\1node2.network.com@g'/etc/sysconfig/network
node3
# hostname node3.network.com
# uname -n
node3.network.com
# sed -i 's@\(HOSTNAME=\).*@\1node3.network.com@g'/etc/sysconfig/network
node1添加hosts解析
# vim /etc/hosts
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.1.101 node1.network.com node1
172.16.1.105 node2.network.com node2
172.16.1.110 node3.network.com node3
拷贝此hosts文件至node2
# scp /etc/hosts node2:/etc/
The authenticity of host 'node2 (172.16.1.105)' can't be established.
RSA key fingerprint is 13:42:92:7b:ff:61:d8:f3:7c:97:5f:22:f6:71:b3:24.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2,172.16.1.105' (RSA) to the list of known hosts.
root@node2's password:
hosts 100%233 0.2KB/s 00:00
拷贝此hosts文件至node3
# scp /etc/hosts node3:/etc/
The authenticity of host 'node3 (172.16.1.110)' can't be established.
RSA key fingerprint is 13:42:92:7b:ff:61:d8:f3:7c:97:5f:22:f6:71:b3:24.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node3,172.16.1.110' (RSA) to the list of known hosts.
hosts 100%320 0.3KB/s 00:00
3、ssh互信通信
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
node1
# ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''
Generating public/private rsa key pair.
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? n # 我这里已经生成过了
# ssh-copy-id -i ~/.ssh/id_rsa.pub node2
root@node2's password:
Now try logging into the machine, with "ssh 'node2'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
# setenforce 0
# ssh node2 'ifconfig'
eth0 Link encap:EthernetHWaddr 00:0C:29:D6:03:52
inet addr:172.16.1.105Bcast:255.255.255.255Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed6:352/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:9881 errors:0 dropped:0 overruns:0 frame:0
TX packets:11220 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5898514 (5.6 MiB)TX bytes:1850217 (1.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:16436Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1112 (1.0 KiB)TX bytes:1112 (1.0 KiB)
同理node2也需要做同样的双击互信,一样的操作,此处不再演示
4、关闭iptables和selinux
node1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# service iptables stop
# vim /etc/sysconfig/selinux
# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
#SELINUX=permissive
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
node2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# service iptables stop
# vim /etc/sysconfig/selinux
# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
#SELINUX=permissive
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
node3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# service iptables stop
# vim /etc/sysconfig/selinux
# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
#SELINUX=permissive
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
页:
[1]