加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

vertica数据库增加/删除节点

(2013-06-08 14:56:47)
标签:

it

原创

分类: Vertica
     由于vertica是基于MPP构架,所它的线性扩展性很好。而且扩展操作也比较简单。今天就记录下vertica数据库的节点增加和删除操作。
  环境:操作系统版本:Red Hat Enterprise Linux Server release 6.2 64位
        数据库:现有node1和node2,两个节点的的vertica数据库,增加一个node3 节点
一.增加节点
  1.检查新加入服务器的各项参数检查。具体详见在vmware下安装配置vertica数据库
  2.修改配置文件(每个节点都要做)
    登陆集群中的每台服务器,修改/etc/hosts 文件,把需要加入集群的ip地址加入该文件,
新加入集群的服务器node3,其IP如下:10.10.10.103 192.168.100.103 到/etc/hosts里。(在该例子里10.10.10.X 是vertica的对外服务IP,192.168.100.X 为数据库的私有通信IP),修改后如下所示

[root@node1 sbin]# more /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.101          node1
10.10.10.102          node2
10.10.10.103          node3     
192.168.100.101       node1-priv
192.168.100.102       node2-priv
192.168.100.103       node3-priv

  2.在node1以root用户登陆服务器,并执行如下命令/opt/vertica/sbin/update_vertica -A 192.168.100.103  -r /tmp/vertica-6.1.1-0.x86_64.RHEL5.rpm
其中 -A 表示要增加的节点,这里可以是IP,也可以是/etc/hosts 文件里定义的hostname
     -r 表示vertica的rpm包存放的路径
这里有一点要注意,该脚本会自动在新节点上创建dbadmin用户和dbadmingroup,在执行阶段需要我们数据该用户的密码。

[root@node1 tmp]# /opt/vertica/sbin/update_vertica -A 192.168.100.103  -r /tmp/vertica-6.1.1-0.x86_64.RHEL5.rpm -p dbadmin

Vertica Analytic Database 6.1.1-0 Installation Tool
Starting installation tasks... 
Getting system information for cluster (this may take a while)....
backing up admintools.conf on 192.168.100.102 
backing up admintools.conf on 192.168.100.101 
Installing rpm on 1 hosts....
installing node....  192.168.100.103
NTP service not synchronized on the hosts: ['192.168.100.103']
Check your NTP configuration for valid NTP servers.
Vertica recommends that you keep the system clock synchronized using
NTP or some other time synchronization mechanism to keep all hosts
synchronized. Time variances can cause (inconsistent) query results
when using Date/Time Functions. For instructions, see:
  * http://kbase.redhat.com/faq/FAQ_43_755.shtm
  * http://kbase.redhat.com/faq/FAQ_43_2790.shtm
Info: the package 'pstack' is useful during troubleshooting.  Vertica recommends this package is installed.
Checking/fixing OS parameters.....

Setting vm.min_free_kbytes to 4096 ...
Detected cpufreq module loaded on 192.168.100.102
Detected cpufreq module loaded on 192.168.100.103
Detected cpufreq module loaded on 192.168.100.101
CPU frequency scaling is enabled.  This may adversely affect the performance of your database.
Vertica recommends that cpu frequency scaling be turned off or set to 'performance'


Creating/Checking Vertica DBA group

Creating/Checking Vertica DBA user

Installing/Repairing SSH keys for dbadmin

Password:
Modifying existing Vertica DBA user

Creating Vertica Data Directory...

Testing N-way network test.  (this may take a while)
 All hosts are available                            ...  
Verifying system requirements on cluster.
 IP configuration                                   ...  
 IP configuration                                   ...  
 IP configuration                                   ...  


Running Consistency Tests
 LANG and TZ environment variables                  ...  
Running Network Connectivity and Throughput Tests...
Waiting for 1 of 3 sites...                         ...  

  Consistency Test (ok)  
=========================

  Info: The $TZ environment variable is not set on  192.168.100.103
  Info: The $TZ environment variable is not set on  192.168.100.102
  Info: The $TZ environment variable is not set on  192.168.100.101

  Network Test (ok)  
=====================

    Network communication (ok)  
  ------------------------------
    Low throughput 192.168.100.102 to 192.168.100.103: 55.8348478581 Mbps; check network interface/switch configuration
  

Updating spread configuration...
Verifying spread is running on old cluster
Signaling spread to reload configuration
Verifying new spread configuration on the existing cluster
Verifying spread configuration on whole cluster.
Creating node node0003 definition for host 192.168.100.103
... Done
Error Monitor  0 errors  3 warnings
Installation completed with warnings.  
Installation complete.

To create a database:
1. Logout and login as dbadmin.**
2. Run /opt/vertica/bin/adminTools as dbadmin
3. Select Create Database from the Configuration Menu

** The installation modified the group privileges for dbadmin.
   If you used sudo to install vertica as dbadmin, you will 
   need to logout and login again before the privileges are applied.

To add or remove hosts, select Cluster Management from the Advanced Menu

3.在新增节点node3上创建数据存放文件夹,并把数据文件夹的own改为dbadmin(在这里vertica数据库的catalog 和datafile统一都存放在每个节点的/dta/vertica下面)
 [root@node3 data]# ll
total 20
drwx------ 2 dbadmin verticadba 16384 Mar 26  2013 lost+found
drwxrwxr-x 4 root    root        4096 Dec Advanced Tools Menu21 20:37 vertica
[root@node3 data]# chown -R dbadmin:dbadmin vertica
[root@node3 data]# ll
total 20
drwx------ 2 dbadmin verticadba 16384 Mar 26  2013 lost+found
drwxrwxr-x 4 dbadmin dbadmin     4096 Dec 21 20:37 vertica

4.以dbadmin用户登陆node1执行adminools命令,进入图形界面
   然后Advanced Tools Menu ==>Cluster Managerment==>Add Host(s)
   选择添加的数据库,然后ok确定
 选择添加要添加的节点,ok确定

确认信息,点击Yes
输入数据库超级用户dbadmin的密码
http://s2/mw690/7c0ae04bgdddcf8f95531&690
至此就等着设置全部完毕,等着返回成功的提示。
5.安装完毕后我们来检测下
[dbadmin@node1 ~]$ vsql
Password: 
Welcome to vsql, the Vertica Analytic Database interactive terminal.

Type:  \h or \? for help with vsql commands
       \g or terminate with semicolon to execute query
       \q to quit

dbadmin=> select * from nodes;
      node_name       |      node_id      | node_state |  node_address   | export_address  |                             catalog_path                             | is_ephemeral 
----------------------+-------------------+------------+-----------------+-----------------+----------------------------------------------------------------------+--------------
 v_myvertica_node0001 | 45035996273704980 | UP         | 192.168.100.101 | 192.168.100.101 | /data/vertica/catalog/myvertica/v_myvertica_node0001_catalog/Catalog | f
 v_myvertica_node0002 | 45035996273718998 | UP         | 192.168.100.102 | 192.168.100.102 | /data/vertica/catalog/myvertica/v_myvertica_node0002_catalog/Catalog | f
 v_myvertica_node0003 | 45035996273719190 | UP         | 192.168.100.103 | 192.168.100.103 | /data/vertica/catalog/myvertica/v_myvertica_node0003_catalog/Catalog | f
(3 rows)
可以看出node3节点已经成功加入数据库 

二 删除节点
   删除节点的操作顺序和增加节点的一个反操作。也是分2步
1.把节点从数据库里移除
  在想要从数据库删除节点,必须满足一下几个条件
   ①要删除的节点上必须是空的。这就意味着,我们需要修改vertica数据库的k-safe的值。
     使之能满足安全需求,从而能把该节点从数据库移除。
   ②数据库必须是启动的
   ③critical node不能被删除
   如果满足以上需求,那操作就比较简单了。
   以dbadmin用户登陆node1执行adminools命令,进入图形界面
   然后Advanced Tools Menu ==>Cluster Managerment==> Remove Host(s)
  和增加节点一样,我们依然要选择哪个节点从哪个数据库里删除,这里我就不一一截图了。
2.把节点从集群里移除
  # /opt/vertica/sbin/update_vertica -R host -r /tmp/vertica-6.1.1-0.x86_64.RHEL5.rpm

 这样我们就把一个节点从及群里移除了。

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有