OpenText Analytics Database 旧Vertica

技術情報サイト

Analytics Database

コマンドラインでデータベースを作成/削除する方法

公開日:
更新日:
基本操作
#admintools
#コマンド

概要

admintoolsコマンドのコマンドラインツールを使用することで、コマンド実行のみでデータベースを作成することができます。
CUIによる対話形式の操作が必要ないため、人的な操作ミスの心配がなく、またシェルスクリプト等に組み込むことが可能です。

構文

作成

admintools -t create_db -d データベース名 -p パスワード

削除

admintools -t drop_db -d データベース名

基本的な実行例

データベースの作成

1台構成の場合
--sampleというデータベースを作成
$ admintools -t create_db -d sample -p sample -s 10.0.0.132
Database with 1 or 2 nodes cannot be k-safe and it may lose data if it crashes
Distributing changes to cluster.
        Creating database sample
        Starting bootstrap node v_sample_node0001 (10.0.0.132)
        Starting nodes:
                v_sample_node0001 (10.0.0.132)
        Starting Vertica on all nodes. Please wait, databases with a large catalog may take a while to initialize.
        Node Status: v_sample_node0001: (DOWN)
        Node Status: v_sample_node0001: (DOWN)
        Node Status: v_sample_node0001: (DOWN)
        Node Status: v_sample_node0001: (DOWN)
        Node Status: v_sample_node0001: (UP)
Installing kafka package
        Success: package kafka installed
Installing voltagesecure package
        Success: package voltagesecure installed
Installing MachineLearning package
        Success: package MachineLearning installed
Installing AWS package
        Success: package AWS installed
Installing VFunctions package
        Success: package VFunctions installed
Installing ParquetExport package
        Success: package ParquetExport installed
Installing flextable package
        Success: package flextable installed
Installing approximate package
        Success: package approximate installed
Installing place package
        Success: package place installed
Installing txtindex package
        Success: package txtindex installed
Installing logsearch package
        Success: package logsearch installed
Database creation SQL tasks completed successfully.
Database sample created successfully.
3台構成の場合
--sample2というデータベースを作成
$ admintools -t create_db -d sample2 -p sample2 -s 10.0.0.132,10.0.0.133,10.0.0.134
Distributing changes to cluster.
        Creating database sample2
        Starting bootstrap node v_sample2_node0001 (10.0.0.132)
        Starting nodes:
                v_sample2_node0001 (10.0.0.132)
        Starting Vertica on all nodes. Please wait, databases with a large catalog may take a while to initialize.
        Node Status: v_sample2_node0001: (DOWN)
        Node Status: v_sample2_node0001: (DOWN)
        Node Status: v_sample2_node0001: (DOWN)
        Node Status: v_sample2_node0001: (DOWN)
        Node Status: v_sample2_node0001: (UP)
        Creating database nodes
        Creating node v_sample2_node0002 (host 10.0.0.133)
        Creating node v_sample2_node0003 (host 10.0.0.134)
        Generating new configuration information
        Stopping single node db before adding additional nodes.
                Database shutdown complete
        Starting all nodes
Start hosts = ['10.0.0.132', '10.0.0.133', '10.0.0.134']
        Starting nodes:
                v_sample2_node0001 (10.0.0.132)
                v_sample2_node0002 (10.0.0.133)
                v_sample2_node0003 (10.0.0.134)
        Starting Vertica on all nodes. Please wait, databases with a large catalog may take a while to initialize.
        Node Status: v_sample2_node0001: (DOWN) v_sample2_node0002: (DOWN) v_sample2_node0003: (DOWN)
        Node Status: v_sample2_node0001: (DOWN) v_sample2_node0002: (DOWN) v_sample2_node0003: (DOWN)
        Node Status: v_sample2_node0001: (DOWN) v_sample2_node0002: (DOWN) v_sample2_node0003: (DOWN)
        Node Status: v_sample2_node0001: (INITIALIZING) v_sample2_node0002: (DOWN) v_sample2_node0003: (INITIALIZING)
        Node Status: v_sample2_node0001: (UP) v_sample2_node0002: (UP) v_sample2_node0003: (UP)
Installing kafka package
        Success: package kafka installed
Installing voltagesecure package
        Success: package voltagesecure installed
Installing MachineLearning package
        Success: package MachineLearning installed
Installing AWS package
        Success: package AWS installed
Installing VFunctions package
        Success: package VFunctions installed
Installing ParquetExport package
        Success: package ParquetExport installed
Installing flextable package
        Success: package flextable installed
Installing approximate package
        Success: package approximate installed
Installing place package
        Success: package place installed
Installing txtindex package
        Success: package txtindex installed
Installing logsearch package
        Success: package logsearch installed
Database creation SQL tasks completed successfully.
Database sample2 created successfully.

データベースの削除

--testというデータベースを削除します。
$ admintools -t drop_db -d test
Database test dropped

注意点

・データベースの作成時、既存のデータベースは全て停止している必要があります。
一つのサーバ上で同時に起動できるVerticaデータベースは一つのみであるためです。
停止していない場合、以下のエラーが発生します。

$ admintools -t create_db -d sample -p sample -s 10.0.0.132
Database with 1 or 2 nodes cannot be k-safe and it may lose data if it crashes
Distributing changes to cluster.
ERROR: running database 'test' already uses port 5433
ERROR: you must first stop database 'test' before creating a new database
Error: ERROR: running database 'test' already uses port 5433
ERROR: you must first stop database 'test' before creating a new database

・データベースの削除時、削除対象のデータベースは停止している必要があります。
停止していない場合、以下のエラーが発生します。

$ admintools -t drop_db -d sample2
Database sample2 is currently running and
must be stopped before it can be dropped.

オプション

オプション名

内容

-h
--help

このヘルプメッセージを表示して終了します

-D ディレクトリ
--data_path=ディレクトリ

データディレクトリのパス

-c ディレクトリ
--catalog_path=ディレクトリ

カタログディレクトリのパス

-d DB名
--database=DB名

作成するデータベースの名前
※省略不可

-l ライセンスファイル
--license=ライセンスファイル

データベースライセンス

-p DBのパスワード
--password=DBのパスワード

データベースパスワード

-P POLICY, --policy=POLICY

データベース再起動ポリシー

-s ホスト
--hosts=ホスト

データベースにクラスタを構成するノードのIPアドレス
※複数記述する場合、カンマ区切りで指定

--shard-count=シャード数

データベース内のシャードの数
※Eonモードのみ

--communal-storage-location=COMMUNAL_STORAGE_LOCATION

共有ストレージの場所
※Eonモードのみ

-x COMMUNAL_STORAGE_PARAMS
--communal-storage-params=COMMUNAL_STORAGE_PARAMS

共有ストレージパラメータファイルの場所
※Eonモードのみ

--depot-path=DEPOT_PATH

デポディレクトリへのパス
※Eonモードのみ

--depot-size=DEPOT_SIZE

デポのサイズ
※Eonモードのみ

--force-cleanup-on-failure

コマンドの失敗時、既に作成されたディレクトリを強制的に削除

--force-removal-at-creation

データベースを作成する前に既存のディレクトリを強制的に削除

参考情報

Writing Administration Tools Scripts
https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/AdministratorsGuide/AdminTools/WritingAdministrationToolsScripts.htm

コマンドラインによるadmintoolsの操作方法
https://www.ashisuto.co.jp/cm/analytics-database/admintools_commandline.html

データベースの停止、起動方法(admintools)
https://www.ashisuto.co.jp/cm/analytics-database/stop_start_database_admintools.html

検証バージョンについて

この記事の内容はVertica 9.3で確認しています。

更新履歴

2020/4/2 本記事を公開