Pcsd
Version vom 26. Oktober 2016, 09:26 Uhr von Janning (Diskussion | Beiträge) (→Apache2 als Cluster-Service)
ubuntu 16.04
- apt-get update
- apt-get uograde
- apt-get install pacemaker corosync pcs
- gem install orderedhash
- sed -i.bak -e "/Host.*=>/s/::/*/" -e "/BindAddress.*=>/s/::/nil/" /usr/share/pcsd/ssl.rb
- /usr/lib/python2.7/dist-packages/pcs/cluster.py
Zeile 1699
os.system("find /var/lib -path '/var/lib/lxcfs' -prune -o -name '"+name+"' -exec rm -f \{\} \;") [Unbedingt das Leerzeichen mit kopieren] #os.system("find /var/lib -name '"+name+"' -exec rm -f \{\} \;")
- mkdir -p 777 /var/log/cluster
- systemctl enable pcsd
- root@adin:~# passwd hacluster
- root@keks:~# passwd hacluster
root@adin:~# pcs cluster auth adin keks
Username: hacluster
Password:
keks: Authorized
adin: Authorized
- root@adin:~# pcs cluster setup --name mycluster adin keks --force
- root@adin:~# pcs cluster start --all
Die Installation verifizieren
- root@adin:~# corosync-cfgtool -s
Printing ring status.
Local node ID 1
RING ID 0
id = 192.168.50.51
status = ring 0 active with no faults
- root@adin:~# corosync-cmapctl | grep members
runtime.totem.pg.mrp.srp.members.1.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.1.ip (str) = r(0) ip(192.168.50.51)
runtime.totem.pg.mrp.srp.members.1.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.1.status (str) = joined
runtime.totem.pg.mrp.srp.members.2.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.2.ip (str) = r(0) ip(192.168.50.52)
runtime.totem.pg.mrp.srp.members.2.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.2.status (str) = joined
STONEIT deaktivieren
- pcs property set stonith-enabled=false
- crm_verify -L
pcs hilfe anzeigen
- root@adin:~# pcs
Usage: pcs [-f file] [-h] [commands]...
Control and configure pacemaker and corosync.
Options:
-h, --help Display usage and exit
-f file Perform actions on file instead of active CIB
--debug Print all network traffic and external commands run
--version Print pcs version information
Commands:
cluster Configure cluster options and nodes
resource Manage cluster resources
stonith Configure fence devices
constraint Set resource constraints
property Set pacemaker properties
acl Set pacemaker access control lists
status View cluster status
config View and manage cluster configuration
pcsd Manage pcs daemon
node Manage cluster nodes
- root@adin:~# pcs status help
Usage: pcs status [commands]...
View current cluster and resource status
Commands:
[status] [--full | --hide-inactive]
View all information about the cluster and resources (--full provides
more details, --hide-inactive hides inactive resources)
resources
View current status of cluster resources
groups
View currently configured groups and their resources
cluster
View current cluster status
corosync
View current membership information as seen by corosync
nodes [corosync|both|config]
View current status of nodes from pacemaker. If 'corosync' is
specified, print nodes currently configured in corosync, if 'both'
is specified, print nodes from both corosync & pacemaker. If 'config'
is specified, print nodes from corosync & pacemaker configuration.
pcsd [<node>] ...
Show the current status of pcsd on the specified nodes.
When no nodes are specified, status of all nodes is displayed.
xml
View xml version of status (output from crm_mon -r -1 -X)
Eine Ressource (ClusterIP) hinzufügen
- root@francis:~# pcs resource create ClusterIP ocf:heartbeat:IPaddr2 \
- > ip=192.168.242.151 cidr_netmask=21 op monitor interval=30s
- root@francis:~# pcs resource show --full
root@francis:~# pcs resource show --full
Resource: ClusterIP (class=ocf provider=heartbeat type=IPaddr2)
Attributes: ip=192.168.242.151 cidr_netmask=21
Operations: start interval=0s timeout=20s (ClusterIP-start-interval-0s)
stop interval=0s timeout=20s (ClusterIP-stop-interval-0s)
monitor interval=30s (ClusterIP-monitor-interval-30s)
Apache2 als Cluster-Service
- apt-get install apache2
- vi /var/www/html/index.html
<html>
<body>My Test Site - $(hostname)</body>
</html>
- vi /etc/apache2/conf-available/status.conf
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
- cd /etc/apache2/conf-enabled/
- ln -s ../conf-available/status.conf .
- pcs resource create WebSite ocf:heartbeat:apache \
- >configfile=/etc/apache2/apache2.conf \
- >statusurl="http://localhost/server-status" \
- >op monitor interval=1min
- pcs status
Cluster name: underwood
Last updated: Wed Oct 26 11:25:04 2016 Last change: Wed Oct 26 11:23:36 2016 by root via cibadmin on francis
Stack: corosync
Current DC: francis (version 1.1.14-70404b0) - partition with quorum
2 nodes and 2 resources configured
Online: [ claire francis ]
Full list of resources:
VirtualIP (ocf::heartbeat:IPaddr2): Started claire
WebSite (ocf::heartbeat:apache): Started francis
PCSD Status:
francis: Online
claire: Online
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled