[root@filer1 ~]# ip addr 1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000 link/ether 1c:87:2c:47:db:1f brd ff:ff:ff:ff:ff:ff 3: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc mq qlen 1000 link/ether 00:1b:21:89:43:6c brd ff:ff:ff:ff:ff:ff inet 10.10.10.101/24 brd 10.10.10.255 scope global eth0 inet6 fe80::21b:21ff:fe89:436c/64 scope link valid_lft forever preferred_lft forever 4: eth1: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc mq qlen 1000 link/ether 00:1b:21:89:43:6d brd ff:ff:ff:ff:ff:ff inet 10.10.100.101/24 brd 10.10.100.255 scope global eth1 inet6 fe80::21b:21ff:fe89:436d/64 scope link valid_lft forever preferred_lft forever
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[root@filer2 ~]# ip addr 1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000 link/ether 10:c3:7b:93:2b:21 brd ff:ff:ff:ff:ff:ff 3: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc mq qlen 1000 link/ether 00:1b:21:89:42:40 brd ff:ff:ff:ff:ff:ff inet 10.10.10.102/24 brd 10.10.10.255 scope global eth0 inet6 fe80::21b:21ff:fe89:4240/64 scope link valid_lft forever preferred_lft forever 4: eth1: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc mq qlen 1000 link/ether 00:1b:21:89:42:41 brd ff:ff:ff:ff:ff:ff inet 10.10.100.102/24 brd 10.10.100.255 scope global eth1 inet6 fe80::21b:21ff:fe89:4241/64 scope link valid_lft forever preferred_lft forever
修改hosts
1 2 3 4 5 6
[root@filer1 ~]# vi /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 filer1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 10.10.10.102 filer2
1 2 3 4 5 6
[root@filer2 ~]# vi /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 filer2 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 10.10.10.101 filer1
Generating public/private dsa key pair. Enter file inwhich to save the key (/root/.ssh/id_dsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. The key fingerprint is: 99:47:bf:53:30:4f:ff:7c:b4:5e:1f:52:02:7b:fe:36 root@filer1 The key's randomart image is: +--[ DSA 1024]----+ | | | | | ..o . | | + .o= . | | S ...oo.o| | . ooooo| | oo o=| | .+E=| | .oo| +-----------------+
The authenticity of host 'filer2 (10.10.10.102)' can't be established. RSA key fingerprint is f8:7a:34:27:6c:5f:bc:cc:53:1f:49:1d:0d:88:4a:ec. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'filer2,10.10.10.102' (RSA) to the list of known hosts. root@filer2's password: Now try logging into the machine, with "ssh 'filer2'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
Generating public/private dsa key pair. Enter file inwhich to save the key (/root/.ssh/id_dsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. The key fingerprint is: 27:77:a9:ed:1c:d8:2e:9d:23:1e:b1:27:98:75:62:66 root@filer2 The key's randomart image is: +--[ DSA 1024]----+ | | | | | | | . | | S E + | | @ @ | | o *.=. | | oB+. | | ..o+. | +-----------------+
The authenticity of host 'filer1 (10.10.10.101)' can't be established. RSA key fingerprint is 2d:f6:80:73:6e:e5:42:03:26:f6:c5:23:57:2f:42:fb. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'filer1,10.10.10.101' (RSA) to the list of known hosts. root@filer1's password: Now try logging into the machine, with "ssh 'filer1'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System
Disk /dev/sdb: 250.1 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x9f02b0bc
Device Boot Start End Blocks Id System /dev/sdb1 * 63 1028159 514048+ 83 Linux /dev/sdb2 1028160 17800019 8385930 83 Linux /dev/sdb3 17800020 21992984 2096482+ 82 Linux swap / Solaris
[root@filer1 ~]# fdisk /dev/sda
Command (m forhelp): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System
Command (m forhelp): n Command action e extended p primary partition (1-4) p Partition number (1-4, default 1): Using default value 1 First sector (2048-976773167, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-976773167, default 976773167): +600M
Command (m forhelp): n Command action e extended p primary partition (1-4) p Partition number (1-4, default 2): Using default value 2 First sector (1230848-976773167, default 1230848): Using default value 1230848 Last sector, +sectors or +size{K,M,G} (1230848-976773167, default 976773167): +2048^H^H^H^H^H^H^Hfffd Unsupported sufffd'.' Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte) 2^N: K (KibiByte), M (MebiByte), G (GibiByte) Last sector, +sectors or +size{K,M,G} (1230848-976773167, default 976773167): +8G
Command (m forhelp): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System /dev/sda1 2048 1230847 614400 83 Linux /dev/sda2 1230848 18008063 8388608 83 Linux
Command (m forhelp): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM)
Command (m forhelp): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System /dev/sda1 2048 1230847 614400 83 Linux /dev/sda2 1230848 18008063 8388608 8e Linux LVM
Command (m forhelp): w The partition table has been altered!
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System
Disk /dev/sdb: 160.0 GB, 160040803840 bytes 255 heads, 63 sectors/track, 19457 cylinders, total 312579695 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System /dev/sdb1 * 63 1028159 514048+ 83 Linux /dev/sdb2 1028160 17800019 8385930 83 Linux /dev/sdb3 17800020 21992984 2096482+ 82 Linux swap / Solaris
[root@filer2 ~]# fdisk /dev/sda
The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted.
Command (m forhelp): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System
Command (m forhelp): n Command action e extended p primary partition (1-4) p Partition number (1-4, default 1): Using default value 1 First sector (2048-976773167, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-976773167, default 976773167): +600M
Command (m forhelp): n Command action e extended p primary partition (1-4) p Partition number (1-4, default 2): Using default value 2 First sector (1230848-976773167, default 1230848): Using default value 1230848 Last sector, +sectors or +size{K,M,G} (1230848-976773167, default 976773167): +8G
Command (m forhelp): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM)
Command (m forhelp): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x1c041c04
Device Boot Start End Blocks Id System /dev/sda1 2048 1230847 614400 83 Linux /dev/sda2 1230848 18008063 8388608 8e Linux LVM
Command (m forhelp): w The partition table has been altered!
Do you want to proceed? [need to type'yes' to confirm] yes
You want me to create a v08 style flexible-size internal meta data block. There appears to be a v08 flexible-size internal meta data block already in place on /dev/sda1 at byte offset 629141504 Do you really want to overwrite the existing v08 meta-data? [need to type'yes' to confirm] yes
Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created.
Do you want to proceed? [need to type'yes' to confirm] yes
Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created. success [root@filer1 etc]# drbdadm create-md data1 md_offset 8589930496 al_offset 8589897728 bm_offset 8589635584
Found some data
==> This might destroy existing data! <==
Do you want to proceed? [need to type'yes' to confirm] yes
You want me to create a v08 style flexible-size internal meta data block. There appears to be a v08 flexible-size internal meta data block already in place on /dev/sda2 at byte offset 8589930496 Do you really want to overwrite the existing v08 meta-data? [need to type'yes' to confirm] yes
Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created.
[root@filer1 ~]# mkfs.ext3 /dev/drbd0 mke2fs 1.41.14 (22-Dec-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 38400 inodes, 153586 blocks 7679 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=159383552 5 block groups 32768 blocks per group, 32768 fragments per group 7680 inodes per group Superblock backups stored on blocks: 32768, 98304
[root@filer1 ~]# pvcreate /dev/drbd1 [root@filer1 ~]# vgcreate data /dev/drbd1 [root@filer1 ~]# lvcreate -L 300M -n filer data
开始corosync配置
创建corosync的KEY
1 2 3 4 5
[root@filer2 ~]# corosync-keygen Corosync Cluster Engine Authentication key generator. Gathering 1024 bits for key from /dev/random. Press keys on your keyboard to generate entropy. Press keys on your keyboard to generate entropy (bits = 128).
[root@filer1 ~]# crm_mon --one-shot -V crm_mon[1722]: 2021/08/16_14:36:24 ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined crm_mon[1722]: 2021/08/16_14:36:24 ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option crm_mon[1722]: 2021/08/16_14:36:24 ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity ============ Last updated: Mon Aug 16 14:36:24 2021 Stack: openais Current DC: filer2 - partition with quorum Version: 1.1.2-c6b59218ee949eebff30e837ff6f3824ed0ab86b 2 Nodes configured, 2 expected votes 0 Resources configured. ============
Attempting connection to the cluster... ============ Last updated: Tue Aug 17 07:55:40 2021 Stack: openais Current DC: filer2 - partition with quorum Version: 1.1.2-c6b59218ee949eebff30e837ff6f3824ed0ab86b 2 Nodes configured, 2 expected votes 2 Resources configured. ============
Online: [ filer1 filer2 ]
Resource Group: g_services MetaFS (ocf::heartbeat:Filesystem): Started filer2 lvmdata (ocf::heartbeat:LVM): Started filer2 openfiler (lsb:openfiler): Started filer2 ClusterIP (ocf::heartbeat:IPaddr2): Started filer2 iscsi (lsb:iscsi-target): Started filer2 samba (lsb:smb): Started filer2 nfs (lsb:nfs): Started filer2 nfslock (lsb:nfslock): Started filer2 Master/Slave Set: ms_g_drbd Masters: [ filer2 ] Slaves: [ filer1 ]