Print

某局点CloudOS集群挂载IP共享存储,重启CloudOS节点时数据库丢失?

2018-06-28 发表

组网及说明

场景描述

   在ADDC应用中,使用三台CloudOS做集群,挂载IP共享存储,CloudOS的数据库等目录存储在共享存储上,重启CloudOS中的任意一台,会出现数据库丢失情况

问题描述

数据库正常和丢失时的状态如下:

正常时数据库状态(15条记录):


postgres=# \l 
                                         List of databases 
    Name     |    Owner     | Encoding |   Collate   |    Ctype    |       Access privileges       
-------------+--------------+----------+-------------+-------------+------------------------------- 
 cinder      | cinderuser   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/cinderuser               + 
             |              |          |             |             | cinderuser=CTc/cinderuser 
 cloudos_api | cloudos      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/cloudos                  + 
             |              |          |             |             | cloudos=CTc/cloudos 
 cloudos_web | cloudos      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/cloudos                  + 
             |              |          |             |             | cloudos=CTc/cloudos 
 glance      | glanceuser   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/glanceuser               + 
             |              |          |             |             | glanceuser=CTc/glanceuser 
 heat        | heatuser     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/heatuser                 + 
             |              |          |             |             | heatuser=CTc/heatuser 
 ironic      | ironicuser   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/ironicuser               + 
             |              |          |             |             | irOnicuser=CTc/ironicuser 
 keystone    | keystoneuser | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/keystoneuser             + 
             |              |          |             |             | keystOneuser=CTc/keystoneuser 
 neutron     | neutronuser  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/neutronuser              + 
             |              |          |             |             | neutrOnuser=CTc/neutronuser 
 nova        | novauser     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/novauser                 + 
             |              |          |             |             | novauser=CTc/novauser 
 nova_api    | novauser     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/novauser                 + 
             |              |          |             |             | novauser=CTc/novauser 
 postgres    | postgres     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 sahara      | saharauser   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/saharauser               + 
             |              |          |             |             | saharauser=CTc/saharauser 
 template0   | postgres     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres                  + 
             |              |          |             |             | postgres=CTc/postgres 
 template1   | postgres     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres                  + 
             |              |          |             |             | postgres=CTc/postgres 
 trove       | troveuser    | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/troveuser                + 
             |              |          |             |             | troveuser=CTc/troveuser 
(15 rows)  

postgres=# \q 


重启后数据库状态(共3条记录):

[root@H3CloudOS01 ~]# psql -h 127.0.0.1 -Upostgres 
psql (9.2.15, server 9.2.18) 
Type "help" for help.  

postgres=# \l 
                                  List of databases 
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+----------------------- 
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          + 
           |          |          |             |             | postgres=CTc/postgres 
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          + 
           |          |          |             |             | postgres=CTc/postgres 
(3 rows) 



过程分析

在CloudOS服务器重启后,通过在管理交换机ping CloudOS节点的存储网卡IP和管理网卡IP,发现存储网卡地址晚于管理网卡IP通时,数据库异常,在存储网比管理网先连通时,服务器状态正常。

   怀疑是STP收敛时影响网卡连通时间,把存储交换机与管理交换机上连接服务器的端口更改为边缘端口,多次在管理交换机与存储交换机上ping CloudOS服务器管理网IP与存储网IP联通时间差距很小,数据库正常。

解决方法

【规避措施】
1)关闭存储交换机STP,解决存储网up不及时问题
2)配置存储多路径
3)配置数据库定时备份,保证数据可靠性(手工备份在CloudOS部署界面就有按钮,自动备份需要找二线提供补丁)
4)尽量避免重启服务器或中断存储等人为操作

【版本优化】

 研发在后续版本优化,预计6月底发布。