Hubble常用命令介绍

本页介绍用于配置、启动和管理Hubble集群的命令。

hubble cert

  • 创建本机证书
hubble cert create-ca --certs-dir=certs --ca-key=mysafedirectory/ca.key 
  • 创建其他服务器证书
hubble cert create-node hubble02 192.168.1.12 --certs-dir=certs --ca-key=mysafedirectory/ca.key --overwrite

hubble start

  • 启动一个节点服务
hubble start --locality=country=cn,region=ch-beijin,datacenter=tianyun,rack=1,node=1 --certs-dir=certs --listen-addr=hubble01:15432 --advertise-host=hubble01 --join=hubble01:15432,hubble01:15433,hubble01:15434 --cache=30GiB --max-sql-memory=10GiB --store=path=/data1/hubbledir/hubble1,size=350GiB --http-addr=0.0.0.0:48080  --external-io-dir=/data_shares
  • hubble start查看参数帮助
hubble start --help

hubble init

  • 集群初始化
hubble init --certs-dir=/var/lib/hubble/certs --host=hubble01:15432

hubble node

  • 查看数据库节点状态
hubble node status  --all --certs-dir=certs  --host=hubble01:15432
  id | address  | is_available | is_live | is_decommissioning | membership| is_draining
+----+----------+ --------------+---------+
   1 | h3:26257 |  true         | true    |        true       |  active   |    false
   2 | h2:26257 |  true         | true    |        true       |  active   |    false
   3 | h3:26257 |  true         | true    |        true       |  active   |    false
   4 | h4:26257 |  true         | true    |        true       |  active   |    false
   5 | h5:26257 |  true         | true    |        true       |  active   |    false  
  • 退役节点
hubble node --decommission    5     --certs-dir=certs  --host=hubble05:15432
 id | is_live | replicas | is_decommissioning | is_draining  
+---+---------+----------+--------------------+-------------+
  5 |  true   |       0  |        true        |    false     
(1 row)

hubble sql

  • 连接数据库
hubble sql --certs-dir=/var/lib/hubble/certs --host=hubble01 --user hubble
# Welcome to the HubbleDB SQL shell.
# All statements must be terminated by a semicolon.
# To exit, type: \q.
#
# Server version: HubbleDB v3.10.2-dirty (same version as client)
# Cluster ID: fb578fa1-b32c-4c71-bf5b-a4ee6f2ab28c
#
# Enter \? for a brief introduction.
#
hubble@hubble01:35432/defaultdb>

hubble version

  • 查看数据库版本信息
hubble version
Build Tag:        v3.17-20-g40d6d40a-dirty
Build Time:       2023/01/13 09:52:28
Platform:         linux amd64 (x86_64-redhat-linux)
Go Version:       go1.17.8
C Compiler:       gcc 7.3.1 20180303 (Red Hat 7.3.1-5)
Build Commit ID:  40d6d40a8ac9cf8c8c94d8eba7b6dce4c9a329ea
Build Type:       development