Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




查询集群中的数据库






创建/删除数据库

Code Block
languagebash
$ admintools -t create_db \
> --data_path=/vdata/data/vdb \
> --catalog_path=/vdata/catalog/vdb \
> --database=vdb \
> --password=vertica \ # Database password
> --hosts=vertica2 # Comma-separated list of hosts to participate in database 
Database with 1 or 2 nodes cannot be k-safe and it may lose data if it crashes
Distributing changes to cluster.
Creating database vdb …… 
$ admintools -t view_cluster
DB | Host | State
--------------
vdb | ALL | UP 
$ admintools -t drop_db -d vdb
Database vdb dropped 





创建用户并授权

Code Block
languagebash
$ vsql -h vertica2 #上一步创建数据库指定了特定host的,因此相关数据库只运行在指定的node上
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=>
dbadmin=> create user "Mike" identified by 'inventor';
CREATE USER
dbadmin=> grant usage on schema public to Mike ;
GRANT PRIVILEGE