본문 바로가기
DBMS/Vertica

vsql admintools 사용하기

by yororing 2024. 5. 7.

00 개요

  • SI 1.0 설치 관련 학습 시 VERTICA DB 접속 확인SI-DB 설치 확인 할 때 vertica를 전에 (며칠 전) 설치했었는데 다시 vsql 명령어를 통해서 DB에 접속하려니까 다음과 같은 에러가 뜸
[root@si1dya analytics9.1.4_deploy_dbschema]# vsql -U siuser -w si
vsql: could not connect to server: Connection refused
        Is the server running on host "???" and accepting
        TCP/IP connections on port 5433?
  • 그래서 다음과 같이 입력하여 vertica가 실행되고 있는지 확인해봤는데 실행중이지 않고 있었음
[root@si1dya analytics9.1.4_deploy_dbschema]# netstat -nap | grep 5433
# 출력값 없음
  • 그런데 admintools 명령어는 먹히고 admintools를 통해 DB 확인 시 SI-DB는 잘 생성되어 있음
[dbadmin@si1dya analytics9.1.4_deploy_dbschema]$ admintools

  • sidb가 생성되어 있는 것을 확인
  • 그래서 vertica를 다시 실행시키려고 함

01 Vertica에 연결하기 (Connect to Vertica)

1. DB 시작하기

  • 다음과 같이 입력
$ admintools -t start_db -d DB명 -p 비밀번호 -F
  • 나의 실행 결과
[dbadmin@si1dya analytics9.1.4_deploy_dbschema]$ admintools -t start_db -d sidb -p si -F
        Starting nodes: 
                v_sidb_node0001 (10.0.0.203)
        Starting Vertica on all nodes. Please wait, databases with a large catalog may take a while to initialize.
        Node Status: v_sidb_node0001: (DOWN) 
        Node Status: v_sidb_node0001: (DOWN) 
        Node Status: v_sidb_node0001: (DOWN) 
        Node Status: v_sidb_node0001: (DOWN) 
        Node Status: v_sidb_node0001: (UP) 
Database sidb: Startup Succeeded.  All Nodes are UP

2. DB 연결하기

  • 위에서 DB 시작하고 나니 잘 작동 됨
[dbadmin@si1dya analytics9.1.4_deploy_dbschema]$ vsql -U siuser -w si
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

siuser=>

02 admintools 매뉴얼

admintools(1)                        General Commands Manual                       admintools(1)

NAME
       admintools - the Vertica administration tools shell interface

SYNOPSIS
       admintools [-t toolname] [options]

DESCRIPTION
       admintools  is  a set of tools that allow you to perform administrative tasks quickly and
       easily.  admintools can be run on any node in the cluster. If you omit the  toolname  and
       options  parameters  then  an interactive shell-based graphical interface is started. The
       EULA (license agreement) is displayed the first time that you run admintools as the data‐
       base administrator. You must type accept to accept the agreement and proceed.

OPTIONS
       -t toolname [options], --toolname toolname [options]
              runs the provided toolname and specified options

   TOOLS
       stop_node [options]
              kills the vertica process on one or more hosts using a SIGTERM signal

              Options:
              -h,--help
                     show help message and exit
              -s HOSTS, --hosts=HOSTS
                     comma-separated  list of hosts on which the vertica process is to be killed
                     using a SIGTERM signal
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames
       host_to_node [options]
              convert hostnames into nodenames

              Options:
              -h,--help
                     show help message and exit
              -s HOSTS, --hosts=HOSTS
                     comma separated list of hostnames which is to be converted into its  corre‐
                     sponding nodenames
              -d DB, --database="DB
                     show only node/host mapping for this database.

       install_procedure [options]
              installs an external procedure

              Options:
              -h,--help
                     show help message and exit
              -d DBNAME, --database=DBNAME
                     Name of database for installed procedure
              -f PROCPATH, --file=PROCPATH
                     Path of procedure file to install
              -p OWNERPASSWORD, --password=OWNERPASSWORD
                     Password of procedure file onwer

       show_active_db [options]
              displays the actively running database

              Options:
              -h,--help
                     show help message and exit

       return_epoch [options]
              returns the epoch for the specified database

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database
       stop_db [options]
              stops the specified database

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be stopped
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -F, --force
                     Force the databases to shutdown, even if users are connected.
              -i, --noprompts
                     do not stop and wait for user input(default false)

       db_remove_node [options]
              removes the specified host from the specified database cluster

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be modified
              -s HOSTS, --hosts=HOSTS
                     Name of the host to remove from the db
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -i, --noprompts
                     do not stop and wait for user input(default false)
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

       stop_host [options]

              Options:
              -h,--help
                     show help message and exit
              -s HOSTS, --hosts=HOSTS
                     comma-separated  list of hosts on which the vertica process is to be killed
                     using a SIGTERM signal
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

       list_allnodes [options]
              lists all the nodes in the current clusters including node, host, state,  version,
              and currently running database

              Options:
              -h,--help
                     show help message and exit

       rebalance_data [options]

              Options:
              -h,--help
                     show help message and exit
              -d DBNAME, --dbname=DBNAME
                     database name
              -k KSAFETY, --ksafety=KSAFETY
                     specify the new k value to use
              -p PASSWORD, --password=PASSWORD
              --script
                     Don't re-balance the data, just provide a script for later use.

       logrotateconfig [options]

              Options:
              -h,--help
                     show help message and exit
              -d DBNAME, --dbname=DBNAME
                     database name
              -r ROTATION, --rotation=ROTATION
                     set how often the log is rotated. [daily|weekly|monthly]
              -s MAXLOGSZ, --maxsize=MAXLOGSZ
                     set maximum log size before rotation is forced.
              -k KEEP, --keep=KEEP
                     set # of old logs to keep

       drop_db [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Database to be dropped

       kill_node [options]

              Options:
              -h,--help
                     show help message and exit
              -s HOSTS, --hosts=HOSTS
                     comma-separated  list of hosts on which the vertica process is to be killed
                     using a SIGKILL signal
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

       list_db [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be listed

       kill_host [options]

              Options:
              -h,--help
                     show help message and exit
              -s HOSTS, --hosts=HOSTS
                     comma-separated list of hosts on which the vertica process is to be  killed
                     using a SIGKILL signal
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

       set_restart_policy [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB , --database=DB
                     Name of database for which to set policy
              -p POLICY, --policy=POLICY
                     Restart policy: ('never', 'ksafe', 'always')

       db_status [options]

              Options:
              -h,--help
                     show help message and exit
              -s STATUS, --status=STATUS
                     Database status UP,DOWN or ALL (list running dbs - UP, list down dbs - DOWN
                     list all dbs - ALL) OK

       restart_db [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be restarted
              -e EPOCH, --epoch=EPOCH
                     Epoch at which the database is to be restarted. If 'last' is given as argu‐
                     ment the db is restarted from the last good epoch.
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -i,--noprompts
                     do not stop and wait for user input(default false)

       database_parameters [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database
              -P PARAMETER, --parameter=PARAMETER
                     Database parameter
              -c COMPONENT, --component=COMPONENT
                     Component[optional]
              -s SUBCOMPONENT, --subcomponent=SUBCOMPONENT
                     Sub Component[optional]
              -p PASSWORD, --password=PASSWORD
                     Database password[optional]

       restart_node [options]

              Options:
              -h,--help
                     show help message and exit
              -s NODES, --hosts=NODES
                     comma-separated list of hosts to be restarted
              -d DB, --database=DB
                     Name of database whose node is to be restarted
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -i,--noprompts
                     do not stop and wait for user input(default false)
              -F,--force
                     force the node to start and auto recover if necessary
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

       view_cluster [options]

              Options:
              -h,--help
                     show help message and exit
              -x,--xpand
                     show the full cluster state, node by node
              -d DB, --database=DB
                     filter the output for a single database

       node_map [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     List only data for this database.

       list_host [options]

              Options:
              -h,--help
                     show help message and exit

       start_db [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be started
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -i,--noprompts
                     do not stop and wait for user input(default false)
              -F,--force
                     force  the  database to start at an epoch before data consis‐
                     tency problems were detected.

       edit_auth [options]

              Options:
              -h,--help
                     show help message and exit
              -d DATABASE, --database=DATABASE
                     database to edit authentication parameters for

       command_host [options]

              Options:
              -h,--help
                     show help message and exit
              -c CMD, --command=CMD
                     Command to run

       create_db [options]

              Options:
              -h,--help
                     show help message and exit
              -s NODES, --hosts=NODES
                     comma-separated list of hosts to participate in database
              -d DB, --database=DB
                     Name of database to be created
              -c CATALOG, --catalog_path=CATALOG
                     Path of catalog directory[optional] if not using compat21
              -D DATA, --data_path=DATA
                     Path of data directory[optional] if not using compat21
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes [optional]
              -l LICENSEFILE, --license=LICENSEFILE
                     Database license [optional]
              -P POLICY, --policy=POLICY
                     Database restart policy [optional]
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

       connect_db [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to connect
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes

       list_node [options]

              Options:
              -h,--help
                     show help message and exit
              -n NODENAME, --node=NODENAME
                     Name of the node to be listed

       db_replace_node [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be restarted
              -o ORIGINAL, --original=ORIGINAL
                     Name of host you wish to replace
              -n NEWHOST, --new=NEWHOST
                     Name of the replacement host
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -i,--noprompts
                     do not stop and wait for user input(default false)

       upgrade_license_key [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database [required if databases exist]
              -l LICENSE, --license=LICENSE
                     Database license
              -i INSTALL, --install=INSTALL
                     use  '-i install' to Install a new license. Omit '-i install'
                     Upgrade license
              -p PASSWORD, --password=PASSWORD
                     Database password[optional]

       db_add_node [options]

              Options:
              -h,--help
                     show help message and exit
              -d DB, --database=DB
                     Name of database to be restarted
              -s HOSTS, --hosts=HOSTS
                     Comma separated list of hosts to add to database
              -p DBPASSWORD, --password=DBPASSWORD
                     Database password in single quotes
              -a AHOSTS, --add=AHOSTS
                     Comma separated list of hosts to add to database
              -i,--noprompts
                     do not stop and wait for user input(default false)
              --compat21
                     Use Vertica 2.1 method using node names instead of hostnames

Version 7.1                                1 July 2014                             admintools(1)
 Manual page admintools(1) line 516/558 (END) (press h for help or q to quit)

1. 자주 사용하는 admintools 옵션

1) DB 상태 확인

 

2) DB 시작

 

3) DB 종료

 

참조

  1. man admintools 
  2.  
  3.