Vertica增加一个数据存储的目录
操作语法为:ADD_LOCATION ( 'path' , [ 'node' , 'usage', 'location_label' ] )
比如新增/verticadata2挂节点,需求为在/verticadata2挂节点下新增目录vertica,用于Vertica的数据目录。
各节点执行mkdir -p /verticadata2/vertica;chown -R dbadmin:verticadba /verticadata2/vertica;ls -lh /verticadata2
实现创建目录,赋权,检查是否正确。
实操过程记录:
[root@vertica1 ~]# mkdir -p /verticadata2/vertica;chown -R dbadmin:verticadba /verticadata2/vertica;ls -lh /verticadata2
总用量 20K
drwx------ 2 root root 16K 6月 3 10:08 lost+found
drwxr-xr-x 2 dbadmin verticadba 4.0K 6月 3 10:40 vertica
[root@vertica1 ~]# ssh vertica2
root@vertica2's password:
Last login: Wed Jun 3 10:36:38 2015 from vertica1
[root@vertica2 ~]# mkdir -p /verticadata2/vertica;chown -R dbadmin:verticadba /verticadata2/vertica;ls -lh /verticadata2
总用量 20K
drwx------ 2 root root 16K 6月 3 10:14 lost+found
drwxr-xr-x 2 dbadmin verticadba 4.0K 6月 3 10:41 vertica
[root@vertica2 ~]# ssh vertica3
root@vertica3's password:
Last login: Wed Jun 3 10:37:01 2015 from vertica2
[root@vertica3 ~]# mkdir -p /verticadata2/vertica;chown -R dbadmin:verticadba /verticadata2/vertica;ls -lh /verticadata2
总用量 20K
drwx------ 2 root root 16K 6月 3 09:58 lost+found
drwxr-xr-x 2 dbadmin verticadba 4.0K 6月 3 10:41 vertica
[root@vertica3 ~]# exit
logout
Connection to vertica3 closed.
[root@vertica2 ~]# exit
logout
Connection to vertica2 closed.
[root@vertica1 ~]#
查询节点名称:select node_name from nodes;
在节点1执行下面的添加目录命令即可。
SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0001','DATA');
SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0002','DATA');
SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0003','DATA');
实操过程记录:
[root@vertica1 ~]# su - dbadmin
[dbadmin@vertica1 ~]$ 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 node_name from nodes;
node_name
-------------------
v_testdb_node0001
v_testdb_node0002
v_testdb_node0003
(3 rows)
dbadmin=> SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0001','DATA');
SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0002','DATA');
SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0003','DATA');
ADD_LOCATION
------------------------------
/verticadata2/vertica added.
(1 row)
dbadmin=> SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0002','DATA');
ADD_LOCATION
------------------------------
/verticadata2/vertica added.
(1 row)
dbadmin=> SELECT ADD_LOCATION('/verticadata2/vertica/','v_testdb_node0003','DATA');
ADD_LOCATION
------------------------------
/verticadata2/vertica added.
(1 row)
dbadmin=>
select * from storage_locations;