~]# crm_mon
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 14:53:34 2017 Last change: Tue Jan 17 14:51:11 2017 by h
acluster via crmd on node1.com
2 nodes and 0 resources configured
Online: [ node1.com node2.com ]
No active resources
交互式查看
~]# crm
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 14:54:40 2017 Last change: Tue Jan 17 14:51:11 2017 by h
acluster via crmd on node1.com
2 nodes and 0 resources configured
Online: [ node1.com node2.com ]
No resources
crm(live)# ra> lsb
ocf / .isolation heartbeat openstack pacemaker
service
systemd
crm(live)ra# list lsb 使用list命令查看ra类型中的所执行的应用
netconsole network
crm(live)ra# list systemd
NetworkManager NetworkManager-wait-online
auditd brandbot
corosync cpupower
crond dbus
display-manager dm-event
dracut-shutdown emergency
exim getty@tty1
ip6tables iptables
irqbalance kdump
kmod-static-nodes ldconfig
lvm2-activation lvm2-lvmetad
lvm2-lvmpolld lvm2-monitor
lvm2-pvscan@8:2 microcode
network pacemaker
plymouth-quit plymouth-quit-wait
plymouth-read-write plymouth-start
polkit postfix
rc-local rescue
rhel-autorelabel rhel-autorelabel-mark
rhel-configure rhel-dmesg
rhel-import-state rhel-loadmodules
rhel-readonly rsyslog
sendmail sshd
sshd-keygen syslog
systemd-ask-password-console systemd-ask-password-plymouth
systemd-ask-password-wall systemd-binfmt
systemd-firstboot systemd-fsck-root
systemd-hwdb-update systemd-initctl
systemd-journal-catalog-update systemd-journal-flush
systemd-journald systemd-logind
systemd-machine-id-commit systemd-modules-load
systemd-random-seed systemd-random-seed-load
systemd-readahead-collect systemd-readahead-done
systemd-readahead-replay systemd-reboot
systemd-remount-fs systemd-rfkill@rfkill2
systemd-shutdownd systemd-sysctl
systemd-sysusers systemd-tmpfiles-clean
systemd-tmpfiles-setup systemd-tmpfiles-setup-dev
systemd-udev-trigger systemd-udevd
systemd-update-done systemd-update-utmp
systemd-update-utmp-runlevel systemd-user-sessions
systemd-vconsole-setup tuned
wpa_supplicant
crm(live)ra# list ocf
CTDB ClusterMon Delay
Dummy Filesystem HealthCPU
HealthSMART IPaddr IPaddr2
IPsrcaddr LVM MailTo
NovaEvacuate Route SendArp
Squid Stateful SysInfo
SystemHealth VirtualDomain Xinetd
apache clvm conntrackd
controld db2 dhcpd
docker ethmonitor exportfs
galera garbd iSCSILogicalUnit
iSCSITarget iface-vlan mysql
nagios named nfsnotify
nfsserver nginx nova-compute-wait
oracle oralsnr pgsql
ping pingd portblock
postfix rabbitmq-cluster redis
remote rsyncd slapd
symlink tomcat
crm(live)ra# list ocf heartbeat
CTDB Delay Dummy
Filesystem IPaddr IPaddr2
IPsrcaddr LVM MailTo
Route SendArp Squid
VirtualDomain Xinetd apache
clvm conntrackd db2
dhcpd docker ethmonitor
exportfs galera garbd
iSCSILogicalUnit iSCSITarget iface-vlan
mysql nagios named
nfsnotify nfsserver nginx
oracle oralsnr pgsql
portblock postfix rabbitmq-cluster
redis rsyncd slapd
symlink tomcat
crm(live)ra# list ocf pacemaker
ClusterMon Dummy HealthCPU HealthSMART
Stateful SysInfo SystemHealth controld
ping pingd remote
crm(live)ra# list ocf openstack
NovaEvacuate nova-compute-wait
crm(live)ra# info ocf:heartbeat:IPaddr 使用info命令查看具体使用方法
crm(live)node# ls 节点模式,可以控制节点的standby 上线等动作
.. help fence
show attribute back
cd ready status-attr
quit end utilization
exit ls maintenance
online bye ?
status clearstate standby
list up server
delete
crm(live)node# standby 不加参数即为当前节点作为standby服务器
crm(live)node# cd
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:07:44 2017 Last change: Tue Jan 17 15:07:40 2017 by r
oot via crm_attribute on node1.com
2 nodes and 0 resources configured
Node node1.com: standby 此时node1状态以及为standby
Online: [ node2.com ]
No resources
crm(live)# node
crm(live)node# online 使用online命令进行上线
crm(live)node# cd
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:08:36 2017 Last change: Tue Jan 17 15:08:33 2017 by r
oot via crm_attribute on node1.com
2 nodes and 0 resources configured
Online: [ node1.com node2.com ]
No resources
也可以直接在最外层进行操作
crm(live)# node online node2.com
crm(live)# status
Stack: corosync
n with quorum
15 09:48:17 2017 by root via crm_attribute on node1.com
2 nodes and 0 resources configured
Online: [ node1.com node2.com ]
No resources
使用configure进入配置模式
crm(live)# configure
crm(live)configure# ls
.. get_property cibstatus
primitive set validate_all
help rsc_template ptest
back cd default-timeouts
erase validate-all rsctest
rename op_defaults modgroup
xml quit upgrade
group graph load
master location template
save collocation rm
bye clone ?
ls node default_timeouts
exit acl_target colocation
fencing_topology assist alert
ra schema user
simulate rsc_ticket end
role rsc_defaults monitor
cib property resource
edit show up
refresh order filter
get-property tag ms
verify commit history
delete
location定义资源粘性
property定义群集全局属性
crm(live)# configure
crm(live)configure# property 使用tab键可以查看property的具体内容和使用方法
batch-limit= node-health-strategy=
cluster-delay= node-health-yellow=
cluster-recheck-interval= notification-agent=
concurrent-fencing= notification-recipient=
crmd-transition-delay= pe-error-series-max=
dc-deadtime= pe-input-series-max=
default-action-timeout= pe-warn-series-max=
default-resource-stickiness= placement-strategy=
election-timeout= remove-after-stop=
enable-acl= shutdown-escalation=
enable-startup-probes= start-failure-is-fatal=
have-watchdog= startup-fencing=
is-managed-default= stonith-action=
load-threshold= stonith-enabled=
maintenance-mode= stonith-timeout=
migration-limit= stonith-watchdog-timeout=
no-quorum-policy= stop-all-resources=
node-action-limit= stop-orphan-actions=
node-health-green= stop-orphan-resources=
node-health-red= symmetric-cluster=
crm(live)configure# property no-quorum-policy=
t have quorum
: stop, freeze, ignore, suicide
crm(live)configure# property no-quorum-policy=stop
crm(live)configure# show 查看当前设置
node 1: node1.com
node 2: node2.com \
attributes standby=off
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=1.1.15-11.el7_3.2-e174ec8 \
cluster-infrastructure=corosync \
cluster-name=mycluster \
no-quorum-policy=stop
关闭stonith设备
crm(live)configure# property stonith-enabled=false
定义群集ip
crm(live)configure# primitive webip ocf:heartbeat:IPaddr params ip=192.168.150.80
使用verify进行配置验证
crm(live)configure# verify
使用commit进行配置确认并生效
crm(live)configure# commit
crm(live)configure# show 查看配置
node 1: node1.com \
attributes standby=off
node 2: node2.com
primitive webip IPaddr \
params ip=192.168.150.80
property cib-bootstrap-options: \
have-watchdog=false \
dc-version=1.1.15-11.el7_3.2-e174ec8 \
cluster-infrastructure=corosync \
cluster-name=mycluster \
no-quorum-policy=stop \
stonith-enabled=false
查看状态
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:23:58 2017 Last change: Tue Jan 17 15:23:55 2017 by r
oot via cibadmin on node1.com
2 nodes and 1 resource configured
Online: [ node1.com node2.com ]
Full list of resources:
webip (ocf::heartbeat:IPaddr): Started node1.com 此时webip这个群集资源在node1上
可以通过ip addr 在node1上进行认证
node1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen
1000 link/ether 00:0c:29:98:ad:a4 brd ff:ff:ff:ff:ff:ff
inet 192.168.150.137/24 brd 192.168.150.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet 192.168.150.80/24 brd 192.168.150.255 scope global secondary eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe98:ada4/64 scope link
valid_lft forever preferred_lft forever
让node1切换成standby,查看资源是否会迁移至node2
[iyunv@node1 ~]# crm node standby
[iyunv@node1 ~]# crm status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:26:43 2017 Last change: Tue Jan 17 15:26:40 2017 by r
oot via crm_attribute on node1.com
2 nodes and 1 resource configured
Node node1.com: standby
Online: [ node2.com ]
Full list of resources:
webip (ocf::heartbeat:IPaddr): Started node2.com webip资源以及迁移至node2
验证
node2 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen
1000 link/ether 00:0c:29:f3:13:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.150.138/24 brd 192.168.150.255 scope global eno16777736
valid_lft forever preferred_lft forever
inet 192.168.150.80/24 brd 192.168.150.255 scope global secondary eno16777736
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fef3:1356/64 scope link
valid_lft forever preferred_lft forever
对node1进行online操作,由于没有设定组合粘性,资源还是会停留在node2
[iyunv@node1 ~]# crm node online
[iyunv@node1 ~]# crm status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:30:05 2017 Last change: Tue Jan 17 15:30:02 2017 by r
oot via crm_attribute on node1.com
2 nodes and 1 resource configured
Online: [ node1.com node2.com ]
Full list of resources:
webip (ocf::heartbeat:IPaddr): Started node2.com
可以使用migrate进行资源转移
crm(live)resource# migrate webip node1.com
INFO: Move constraint created for webip to node2.com
crm(live)resource# cd
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:37:00 2017 Last change: Tue Jan 17 15:36:49 2017 by r
oot via crm_resource on node1.com
2 nodes and 1 resource configured
Online: [ node1.com node2.com ]
Full list of resources:
webip (ocf::heartbeat:IPaddr): Started node1.com
在resource中可以进行资源的停止开启和删除
crm(live)resource# stop webip
crm(live)resource# cd
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:38:52 2017 Last change: Tue Jan 17 15:38:50 2017 by r
oot via cibadmin on node1.com
2 nodes and 1 resource configured: 1 resource DISABLED and 0 BLOCKED from being started du
e to failures
Online: [ node1.com node2.com ]
Full list of resources:
webip (ocf::heartbeat:IPaddr): Stopped (disabled)
crm(live)# resource
crm(live)resource# start webip
crm(live)resource# cd
crm(live)# status
Stack: corosync
Current DC: node1.com (version 1.1.15-11.el7_3.2-e174ec8) – partition with quorum
Last updated: Tue Jan 17 15:39:03 2017 Last change: Tue Jan 17 15:39:00 2017 by r
oot via cibadmin on node1.com
2 nodes and 1 resource configured
Online: [ node1.com node2.com ]
Full list of resources:
webip (ocf::heartbeat:IPaddr): Started node1.com
|