Background:在服务上我之前安装过corosync,也跑过pcs cluster auth,后来重新搭ha的时候就遇到报错了。
Error:
[root@node1 ~]# pcs cluster auth node1 node2 node3 --debug(这里加上debug可以查看具体的信息,我也是通过debug信息想到的解决办法)
Running: /usr/bin/ruby -I/usr/lib/pcsd/ /usr/lib/pcsd/pcsd-cli.rb read_tokens
Environment:
CLASSPATH=.:/usr/local/java/jdk1.8/lib:/usr/local/java/jdk1.8/jre/lib
DISPLAY=localhost:11.0
GEM_HOME=/usr/lib/pcsd/vendor/bundle/ruby
HISTCONTROL=ignoredups
HISTSIZE=1000
HOME=/root
HOSTNAME=node1
JRE_HOME=/usr/local/java/jdk1.8/jre
LANG=en_US.UTF-8
LC_ALL=C
LESSOPEN=||/usr/bin/lesspipe.sh %s
LOGNAME=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;3:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;3bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=011:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.b=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=0135:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:m=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;3*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.mid01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
MAIL=/var/spool/mail/root
PATH=/usr/local/java/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
PCSD_DEBUG=true
PCSD_NETWORK_TIMEOUT=60
PWD=/root
SELINUX_LEVEL_REQUESTED=
SELINUX_ROLE_REQUESTED=
SELINUX_USE_CURRENT_RANGE=
SHELL=/bin/bash
SHLVL=1
SSH_CLIENT=192.168.88.1 20544 22
SSH_CONNECTION=192.168.88.1 20544 192.168.88.6 22
SSH_TTY=/dev/pts/1
TERM=xterm
USER=root
XDG_DATA_DIRS=/root/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/
XDG_RUNTIME_DIR=/run/user/0
XDG_SESSION_ID=38
_=/usr/sbin/pcs
--Debug Input Start--
{}
--Debug Input End--
Finished running: /usr/bin/ruby -I/usr/lib/pcsd/ /usr/lib/pcsd/pcsd-cli.rb read_tokens
Return value: 0
--Debug Stdout Start--
{
"status": "ok",
"data": {
"tokens": {
"hadoop01": "f539b080-c5da-4e82-99d0-c3013442f337",
"hadoop02": "2c93fe6c-3843-4c3c-8176-ca5d1370abd6"
},
"ports": {
"hadoop01": 2224,
"hadoop02": 2224
}
},
"log": [
"I, [2020-10-23T13:40:28.491292 #21703] INFO -- : PCSD Debugging enabled\n",
"D, [2020-10-23T13:40:28.491746 #21703] DEBUG -- : Did not detect RHEL 6\n",
"D, [2020-10-23T13:40:28.491787 #21703] DEBUG -- : Detected systemd is in use\n",
"I, [2020-10-23T13:40:28.677625 #21703] INFO -- : Running: /usr/sbin/corosync-cmapctl totem.clus
"I, [2020-10-23T13:40:28.677740 #21703] INFO -- : CIB USER: hacluster, groups: \n",
"D, [2020-10-23T13:40:28.680870 #21703] DEBUG -- : []\n",
"D, [2020-10-23T13:40:28.680964 #21703] DEBUG -- : [\"Failed to initialize the cmap API. Error CS
"D, [2020-10-23T13:40:28.681019 #21703] DEBUG -- : Duration: 0.003099912s\n",
"I, [2020-10-23T13:40:28.681090 #21703] INFO -- : Return Value: 1\n"
]
}
--Debug Stdout End--
--Debug Stderr Start--
--Debug Stderr End--
Sending HTTP Request to: https://node1:2224/remote/check_auth
Data: None
Response Code: 401
--Debug Response Start--
{"notauthorized":"true"}
--Debug Response End--
Communication debug info for calling: https://node1:2224/remote/check_auth
--Debug Communication Output Start--
* About to connect() to node1 port 2224 (#0)
* Trying 192.168.88.6...
* Connected to node1 (192.168.88.6) port 2224 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=hadoop01,OU=pcsd,O=pcsd,L=Minneapolis,ST=MN,C=US
* start date: Oct 21 07:29:38 2020 GMT
* expire date: Oct 19 07:29:38 2030 GMT
* common name: hadoop01
* issuer: CN=hadoop01,OU=pcsd,O=pcsd,L=Minneapolis,ST=MN,C=US
> GET /remote/check_auth HTTP/1.1
User-Agent: PycURL/7.29.0
Host: node1:2224
Accept: */*
< HTTP/1.1 401 Unauthorized
< Content-Type: text/html;charset=utf-8
< Content-Length: 24
< Server:
< Strict-Transport-Security: max-age=604800
< X-Xss-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Date: Fri, 23 Oct 2020 05:40:28 GMT
< Connection: Keep-Alive
<
<< {"notauthorized":"true"}
* Connection #0 to host node1 left intact
--Debug Communication Output End--
Username: hacluster
Password:
Running: /usr/bin/ruby -I/usr/lib/pcsd/ /usr/lib/pcsd/pcsd-cli.rb auth
Environment:
CLASSPATH=.:/usr/local/java/jdk1.8/lib:/usr/local/java/jdk1.8/jre/lib
DISPLAY=localhost:11.0
GEM_HOME=/usr/lib/pcsd/vendor/bundle/ruby
HISTCONTROL=ignoredups
HISTSIZE=1000
HOME=/root
HOSTNAME=node1
JRE_HOME=/usr/local/java/jdk1.8/jre
LANG=en_US.UTF-8
LC_ALL=C
LESSOPEN=||/usr/bin/lesspipe.sh %s
LOGNAME=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;3:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;3bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=011:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.b=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=0135:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:m=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;3*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.mid01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
MAIL=/var/spool/mail/root
PATH=/usr/local/java/jdk1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
PCSD_DEBUG=true
PCSD_NETWORK_TIMEOUT=60
PWD=/root
SELINUX_LEVEL_REQUESTED=
SELINUX_ROLE_REQUESTED=
SELINUX_USE_CURRENT_RANGE=
SHELL=/bin/bash
SHLVL=1
SSH_CLIENT=192.168.88.1 20544 22
SSH_CONNECTION=192.168.88.1 20544 192.168.88.6 22
SSH_TTY=/dev/pts/1
TERM=xterm
USER=root
XDG_DATA_DIRS=/root/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/
XDG_RUNTIME_DIR=/run/user/0
XDG_SESSION_ID=38
_=/usr/sbin/pcs
--Debug Input Start--
{"username": "hacluster", "local": false, "nodes": {"node1": null, "node3": null, "node2": null}, "pa
--Debug Input End--
Finished running: /usr/bin/ruby -I/usr/lib/pcsd/ /usr/lib/pcsd/pcsd-cli.rb auth
Return value: 0
--Debug Stdout Start--
{
"status": "ok",
"data": {
"auth_responses": {
"node1": {
"status": "ok",
"token": "5958bc61-c8b2-469e-8da7-bc18aaa51834"
},
"node2": {
"status": "ok",
"token": "e57f46ff-012d-40d2-962d-4bdb68855807"
},
"node3": {
"status": "ok",
"token": "80366b5e-8c05-4135-971a-f7b2ed3cd782"
}
},
"sync_successful": true,
"sync_nodes_err": [
"hadoop02",
"hadoop01"
],
"sync_responses": {
"hadoop02": {
"status": "error"
},
"hadoop01": {
"status": "error"
}
}
},
"log": [
"I, [2020-10-23T13:40:33.823874 #21714] INFO -- : PCSD Debugging enabled\n",
"D, [2020-10-23T13:40:33.824328 #21714] DEBUG -- : Did not detect RHEL 6\n",
"D, [2020-10-23T13:40:33.824369 #21714] DEBUG -- : Detected systemd is in use\n",
"I, [2020-10-23T13:40:34.010926 #21714] INFO -- : Running: /usr/sbin/corosync-cmapctl totem.clus
"I, [2020-10-23T13:40:34.011138 #21714] INFO -- : CIB USER: hacluster, groups: \n",
"D, [2020-10-23T13:40:34.014167 #21714] DEBUG -- : []\n",
"D, [2020-10-23T13:40:34.014262 #21714] DEBUG -- : [\"Failed to initialize the cmap API. Error CS
"D, [2020-10-23T13:40:34.014324 #21714] DEBUG -- : Duration: 0.003002615s\n",
"I, [2020-10-23T13:40:34.014395 #21714] INFO -- : Return Value: 1\n",
"I, [2020-10-23T13:40:34.015107 #21714] INFO -- : SRWT Node: node3 Request: check_auth\n",
"E, [2020-10-23T13:40:34.015157 #21714] ERROR -- : Unable to connect to node node3, no token avai
"I, [2020-10-23T13:40:34.015297 #21714] INFO -- : SRWT Node: node1 Request: check_auth\n",
"E, [2020-10-23T13:40:34.015335 #21714] ERROR -- : Unable to connect to node node1, no token avai
"I, [2020-10-23T13:40:34.015448 #21714] INFO -- : SRWT Node: node2 Request: check_auth\n",
"E, [2020-10-23T13:40:34.015483 #21714] ERROR -- : Unable to connect to node node2, no token avai
"I, [2020-10-23T13:40:34.173526 #21714] INFO -- : Running: /usr/sbin/pcs status nodes corosync\n
"I, [2020-10-23T13:40:34.174109 #21714] INFO -- : CIB USER: hacluster, groups: \n",
"D, [2020-10-23T13:40:34.454065 #21714] DEBUG -- : [\"Corosync Nodes:\\n\", \" Online:\\n\", \" O
"D, [2020-10-23T13:40:34.454185 #21714] DEBUG -- : []\n",
"D, [2020-10-23T13:40:34.454228 #21714] DEBUG -- : Duration: 0.279954763s\n",
"I, [2020-10-23T13:40:34.454304 #21714] INFO -- : Return Value: 0\n",
"I, [2020-10-23T13:40:34.454775 #21714] INFO -- : Sending config 'tokens' version 3 dfac3b571bf0adoop02\n",
"I, [2020-10-23T13:40:34.455013 #21714] INFO -- : SRWT Node: hadoop02 Request: set_configs\n",
"I, [2020-10-23T13:40:34.455971 #21714] INFO -- : SRWT Node: hadoop01 Request: set_configs\n",
"I, [2020-10-23T13:40:34.517726 #21714] INFO -- : No response from: hadoop02 request: set_config
"I, [2020-10-23T13:40:34.519540 #21714] INFO -- : No response from: hadoop01 request: set_config
"I, [2020-10-23T13:40:34.519849 #21714] INFO -- : Sending config response from hadoop02: {\"stat
"I, [2020-10-23T13:40:34.519967 #21714] INFO -- : Sending config response from hadoop01: {\"stat
]
}
--Debug Stdout End--
--Debug Stderr Start--
--Debug Stderr End--
node1: Authorized
node3: Authorized
node2: Authorized
Error: Unable to synchronize and save tokens on nodes: hadoop02, hadoop01. Are they authorized?
[root@node1 ~]#
Solution: 通过错误信息,然后想到以前配置过corosync文件。查看corosync.conf信息,果然有报错相关的host配置,由于此文件是之前旧环境产生的,这里可以直接删除。
cd /etc/corosync
rm corosync.conf
然后再测试,报错消失。
[root@node1 corosync]# pcs cluster auth node1 node2 node3
Username: hacluster
Password:
node1: Authorized
node3: Authorized
node2: Authorized