代码改变世界

Troubleshooting:重新安装Vertica建库后无法启动

2016-09-12 15:45  AlfredZhao  阅读(1798)  评论(0编辑  收藏  举报

环境:RHEL6.5 + Vertica7.1.0-3

1.故障现象

故障现象:Vertica集群安装成功,但是创建数据库后一直无法up. 具体报错输出如下:
        Starting Vertica on all nodes. Please wait, databases with large catalogs may take a while to initialize.

        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
        Node Status: v_wnop_node0001: (DOWN) 
ERROR:  Database did not start cleanly on initiator node!
        Stopping all nodes

进一步查看vertica日志:

[root@vnode01 v_wnop_node0001_catalog]# tail -f vertica.log 
2016-09-07 15:19:07.018 unknown:0x7f298bac5700 [Txn] <INFO> Found my node (v_wnop_node0001) in the catalog
2016-09-07 15:19:07.018 unknown:0x7f298bac5700 [Txn] <INFO> Catalog info: version=0x1, number of nodes=1, permanent #=1, K=0
2016-09-07 15:19:07.018 unknown:0x7f298bac5700 [Txn] <INFO> Catalog info: current epoch=0x1
2016-09-07 15:19:07.018 unknown:0x7f298bac5700 [Catalog] <INFO> Catalog OID generator updated based on GLOBAL tier catalog
2016-09-07 15:19:07.018 unknown:0x7f298bac5700 [Init] <INFO> Catalog loaded
2016-09-07 15:19:07.018 unknown:0x7f298bac5700 [Comms] <INFO> About to launch spread with '/opt/vertica/spread/sbin/spread -c /data/verticadb/WNOP/v_wnop_node0001_catalog/spread.conf'
2016-09-07 15:19:07.019 unknown:0x7f298bac5700 [Comms] <INFO> forked spread pid=82427, wrote pidfile /data/verticadb/WNOP/v_wnop_node0001_catalog/spread.pid
2016-09-07 15:19:07.020 unknown:0x7f298bac5700 [Init] <INFO> Listening on port: 5433
2016-09-07 15:19:07.020 unknown:0x7f298bac5700 [Init] <INFO> About to fork
2016-09-07 15:19:07.021 unknown:0x7f298bac5700 [Init] <INFO> About to fork again
2016-09-07 15:19:07.023 unknown:0x7f298bac5700 [Init] <INFO> Completed forking
2016-09-07 15:19:07.023 unknown:0x7f298bac5700 [Init] <INFO> Startup [Connecting to Spread] Connecting to spread 4803
2016-09-07 15:19:37.039 unknown:0x7f298bac5700 [Init] <INFO> Spread daemon does not appear to be running on 192.168.1.105 -- exiting!

可以看到大概是spread进程在尝试连接4803端口时有什么样的问题,似乎spread进程压根没启动成功;
在检查各节点的防火墙和SELinux之后,都是关闭的状态,并未发现问题。

2.重装集群

前期准备脚本和互信,可参考:

重装集群(先彻底删除再安装)

--删除集群
--杀掉vertica相关进程
cluster_run_all_nodes "hostname;ps -ef|grep vertica |grep -v grep|awk '{print $2}'|xargs kill -9"

--删除vertica软件
cluster_run_all_nodes "hostname;rpm -e vertica"

--杀掉dbadmin相关进程
cluster_run_all_nodes "hostname;ps -ef|grep dbadmin |grep -v grep|awk '{print $2}'|xargs kill -9"

--删除之前创建的组和用户
cluster_run_all_nodes "hostname;id dbadmin"
cluster_run_all_nodes "hostname;groupdel verticadba"
cluster_run_all_nodes "hostname;userdel -r dbadmin"

--删除数据存储目录,软件安装目录
cluster_run_all_nodes "hostname;rm -rf /data/verticadb"
cluster_run_all_nodes "hostname;rm -rf /opt/vertica"

--创建数据存储目录
cluster_run_all_nodes "hostname;mkdir -p /data/verticadb"

--安装
--安装软件
cd /usr2
rpm -ivh vertica-7.1.0-3.x86_64.RHEL5.rpm 

--安装集群
/opt/vertica/sbin/install_vertica -s 192.168.1.105,192.168.1.106,192.168.1.107,192.168.1.108 -r /usr2/vertica-7.1.0-3.x86_64.RHEL5.rpm --failure-threshold=HALT -u dbadmin -p vertica

--给数据存储目录赋予权限
cluster_run_all_nodes "hostname;chown -R dbadmin:verticadba /data/verticadb"

--建库
admintools建库

结果这样重装安装的环境,依旧报错,报错内容不变。

3.再次定位

# cluster_run_all_nodes "hostname; ls -lh /tmp/4803 "
vnode01
srw-rw-rw- 1 501 501 0 9月   7 09:54 /tmp/4803
vnode02
srw-rw-rw-. 1 501 501 0 9月   7 09:19 /tmp/4803
vnode03
srw-rw-rw-. 1 501 501 0 9月   7 09:19 /tmp/4803
vnode04
srw-rw-rw- 1 501 501 0 9月   7 09:14 /tmp/4803

可以看到/tmp/4803的所属用户和组都是未被识别的uid和gid,怀疑是否是这个问题影响,导致spread进程无法集群间通信。

4.解决问题

再次重装时,dbadmin用户和组的uid,gid有了变化,所以我们将这个文件也先删除掉。
cluster_run_all_nodes "hostname; rm -rf /tmp/4803"

此次环境dbadmin用户和组先统一:

--保持统一的uid gid
cluster_run_all_nodes "hostname;groupadd -g 700 verticadba"
cluster_run_all_nodes "hostname;useradd -g verticadba -u 700 dbadmin"

再次重装,建库时,跟踪/tmp/4083的状态,发现各节点/tmp/4803依次开始正常:

# cluster_run_all_nodes "hostname; ls -lh /tmp/4803 "
vnode01
srw-rw-rw- 1 dbadmin verticadba 0 9月   7 17:04 /tmp/4803
vnode02
ls: 无法访问/tmp/4803: 没有那个文件或目录
vnode03
ls: 无法访问/tmp/4803: 没有那个文件或目录
vnode04
ls: 无法访问/tmp/4803: 没有那个文件或目录

最终确定果然就是这个问题,最终建库成功。

5.总结

在重装Vertica集群时,需要关注 /tmp/4803是否权限有问题,否则会导致spread进程故障,进而导致整个库起不来。 各节点dbadmin用户的uid和gid尽量保持一致。