OpenGemini 运维指南
概述 : OpenGemini 运维
Gemix : 官方部署运维一体化工具
启动集群 : gemix cluster start {geminiClusterName}
[root@vmw-b ~]# gemix cluster start gemini-test
Starting cluster gemini-test...
+ [ Serial ] - SSHKeySet: privateKey=/root/.gemix/storage/cluster/clusters/gemini-test/ssh/id_rsa, publicKey=/root/.gemix/storage/cluster/clusters/gemini-test/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=root, host=192.168.101.102
+ [Parallel] - UserSSH: user=root, host=192.168.101.103
+ [Parallel] - UserSSH: user=root, host=192.168.101.104
+ [Parallel] - UserSSH: user=root, host=192.168.101.102
+ [Parallel] - UserSSH: user=root, host=192.168.101.103
+ [Parallel] - UserSSH: user=root, host=192.168.101.104
+ [Parallel] - UserSSH: user=root, host=192.168.101.102
+ [Parallel] - UserSSH: user=root, host=192.168.101.103
+ [Parallel] - UserSSH: user=root, host=192.168.101.104
+ [Parallel] - UserSSH: user=root, host=192.168.101.105
+ [Parallel] - UserSSH: user=root, host=192.168.101.105
+ [ Serial ] - StartCluster
Starting component ts-metaStarting instance 192.168.101.104:8091Starting instance 192.168.101.102:8091Starting instance 192.168.101.103:8091Start instance 192.168.101.104:8091 successStart instance 192.168.101.103:8091 successStart instance 192.168.101.102:8091 success
Starting component ts-storeStarting instance 192.168.101.104:8401Starting instance 192.168.101.102:8401Starting instance 192.168.101.103:8401Start instance 192.168.101.104:8401 successStart instance 192.168.101.103:8401 successStart instance 192.168.101.102:8401 success
Starting component ts-sqlStarting instance 192.168.101.104:8086Starting instance 192.168.101.102:8086Starting instance 192.168.101.103:8086Start instance 192.168.101.104:8086 successStart instance 192.168.101.103:8086 successStart instance 192.168.101.102:8086 success
Starting component ts-serverStarting instance 192.168.101.105:8186Start instance 192.168.101.105:8186 success
Starting component grafanaStarting instance 192.168.101.105:3000Start instance 192.168.101.105:3000 success
Starting component ts-monitorStarting instance 192.168.101.103Starting instance 192.168.101.104Starting instance 192.168.101.105Starting instance 192.168.101.102Start 192.168.101.104 successStart 192.168.101.103 successStart 192.168.101.105 successStart 192.168.101.102 success
Started cluster `gemini-test` successfully
停运集群 : gemix cluster stop {geminiClusterName}
[root@vmw-b opengemini]# gemix cluster stop gemini-test
Will stop the cluster gemini-test with nodes: , roles: .
Do you want to continue? [y/N]:(default=N) y
+ [ Serial ] - SSHKeySet: privateKey=/root/.gemix/storage/cluster/clusters/gemini-test/ssh/id_rsa, publicKey=/root/.gemix/storage/cluster/clusters/gemini-test/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=root, host=vmw-b.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-c.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-d.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-b.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-c.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-d.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-b.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-c.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-d.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-e.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-e.servers.com
+ [ Serial ] - StopCluster
Stopping component grafanaStopping instance vmw-e.servers.comStop grafana vmw-e.servers.com:3000 success
Stopping component ts-serverStopping instance vmw-e.servers.comStop ts-server vmw-e.servers.com:8186 success
Stopping component ts-sqlStopping instance vmw-d.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStop ts-sql vmw-d.servers.com:8086 successStop ts-sql vmw-c.servers.com:8086 successStop ts-sql vmw-b.servers.com:8086 success
Stopping component ts-storeStopping instance vmw-d.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStop ts-store vmw-d.servers.com:8401 successStop ts-store vmw-c.servers.com:8401 successStop ts-store vmw-b.servers.com:8401 success
Stopping component ts-metaStopping instance vmw-d.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStop ts-meta vmw-d.servers.com:8091 successStop ts-meta vmw-c.servers.com:8091 successStop ts-meta vmw-b.servers.com:8091 success
Stopping component ts-monitorStopping instance vmw-e.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStopping instance vmw-d.servers.comStop vmw-e.servers.com successStop vmw-d.servers.com successStop vmw-c.servers.com successStop vmw-b.servers.com success
Stopped cluster `gemini-test` successfully
[root@vmw-b opengemini]#
卸载集群 : gemix cluster uninstall
[root@vmw-b go-study]# gemix cluster uninstall gemini-test██ ██ █████ ██████ ███ ██ ██ ███ ██ ████████ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ████ █ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ █████ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ███ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████This operation will destroy openGemini v1.2.0 cluster gemini-test and its data.
Are you sure to continue?
(Type "Yes, I know my cluster and data will be deleted." to continue)
: Yes, I know my cluster and data will be deleted.
Destroying cluster...
+ [ Serial ] - SSHKeySet: privateKey=/root/.gemix/storage/cluster/clusters/gemini-test/ssh/id_rsa, publicKey=/root/.gemix/storage/cluster/clusters/gemini-test/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=root, host=vmw-b.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-c.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-d.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-b.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-c.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-d.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-b.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-c.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-d.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-e.servers.com
+ [Parallel] - UserSSH: user=root, host=vmw-e.servers.com
+ [ Serial ] - StopCluster
Stopping component grafanaStopping instance vmw-e.servers.comStop grafana vmw-e.servers.com:3000 success
Stopping component ts-serverStopping instance vmw-e.servers.comStop ts-server vmw-e.servers.com:8186 success
Stopping component ts-sqlStopping instance vmw-d.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStop ts-sql vmw-d.servers.com:8086 successStop ts-sql vmw-c.servers.com:8086 successStop ts-sql vmw-b.servers.com:8086 success
Stopping component ts-storeStopping instance vmw-d.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStop ts-store vmw-c.servers.com:8401 successStop ts-store vmw-d.servers.com:8401 successStop ts-store vmw-b.servers.com:8401 success
Stopping component ts-metaStopping instance vmw-d.servers.comStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStop ts-meta vmw-d.servers.com:8091 successStop ts-meta vmw-c.servers.com:8091 successStop ts-meta vmw-b.servers.com:8091 success
Stopping component ts-monitorStopping instance vmw-b.servers.comStopping instance vmw-c.servers.comStopping instance vmw-d.servers.comStopping instance vmw-e.servers.comStop vmw-c.servers.com successStop vmw-d.servers.com successStop vmw-e.servers.com successStop vmw-b.servers.com success
+ [ Serial ] - UninstallCluster
Destroying component grafanaDestroying instance vmw-e.servers.comDestroy vmw-e.servers.com finished- Destroy grafana paths: [/usr/local/opengemini/gemini-deploy/grafana-3000 /etc/systemd/system/grafana-3000.service]Destroying component ts-serverDestroying instance vmw-e.servers.comDestroy vmw-e.servers.com finished- Destroy ts-server paths: [/usr/local/opengemini/gemini-deploy/ts-server-8186/data /usr/local/opengemini/gemini-log/logs/ts-server-8186 /usr/local/opengemini/gemini-deploy/ts-server-8186 /etc/systemd/system/ts-server-8186.service]Uninstalling monitored vmw-e.servers.comUninstalling instance vmw-e.servers.com
Uninstalling monitored on vmw-e.servers.com success
Destroying component ts-sqlDestroying instance vmw-b.servers.comDestroy vmw-b.servers.com finished- Destroy ts-sql paths: [/usr/local/opengemini/gemini-log/logs/ts-sql-8086 /usr/local/opengemini/gemini-deploy/ts-sql-8086 /etc/systemd/system/ts-sql-8086.service]Destroying instance vmw-c.servers.comDestroy vmw-c.servers.com finished- Destroy ts-sql paths: [/usr/local/opengemini/gemini-log/logs/ts-sql-8086 /usr/local/opengemini/gemini-deploy/ts-sql-8086 /etc/systemd/system/ts-sql-8086.service]Destroying instance vmw-d.servers.comDestroy vmw-d.servers.com finished- Destroy ts-sql paths: [/usr/local/opengemini/gemini-log/logs/ts-sql-8086 /usr/local/opengemini/gemini-deploy/ts-sql-8086 /etc/systemd/system/ts-sql-8086.service]Destroying component ts-storeDestroying instance vmw-b.servers.comDestroy vmw-b.servers.com finished- Destroy ts-store paths: [/data/gemini-data/data /usr/local/opengemini/gemini-log/logs/ts-store-8401 /usr/local/opengemini/gemini-deploy/ts-store-8401 /etc/systemd/system/ts-store-8401.service]Destroying instance vmw-c.servers.comDestroy vmw-c.servers.com finished- Destroy ts-store paths: [/data/gemini-data/data /usr/local/opengemini/gemini-log/logs/ts-store-8401 /usr/local/opengemini/gemini-deploy/ts-store-8401 /etc/systemd/system/ts-store-8401.service]Destroying instance vmw-d.servers.comDestroy vmw-d.servers.com finished- Destroy ts-store paths: [/data/gemini-data/data /usr/local/opengemini/gemini-log/logs/ts-store-8401 /usr/local/opengemini/gemini-deploy/ts-store-8401 /etc/systemd/system/ts-store-8401.service]Destroying component ts-metaDestroying instance vmw-b.servers.comDestroy vmw-b.servers.com finished- Destroy ts-meta paths: [/data/gemini-data/meta /usr/local/opengemini/gemini-log/logs/ts-meta-8091 /usr/local/opengemini/gemini-deploy/ts-meta-8091 /etc/systemd/system/ts-meta-8091.service]Destroying instance vmw-c.servers.comDestroy vmw-c.servers.com finished- Destroy ts-meta paths: [/etc/systemd/system/ts-meta-8091.service /data/gemini-data/meta /usr/local/opengemini/gemini-log/logs/ts-meta-8091 /usr/local/opengemini/gemini-deploy/ts-meta-8091]Destroying instance vmw-d.servers.comDestroy vmw-d.servers.com finished- Destroy ts-meta paths: [/data/gemini-data/meta /usr/local/opengemini/gemini-log/logs/ts-meta-8091 /usr/local/opengemini/gemini-deploy/ts-meta-8091 /etc/systemd/system/ts-meta-8091.service]Uninstalling monitored vmw-b.servers.comUninstalling instance vmw-b.servers.com
Uninstalling monitored on vmw-b.servers.com success
Uninstalling monitored vmw-c.servers.comUninstalling instance vmw-c.servers.com
Uninstalling monitored on vmw-c.servers.com success
Uninstalling monitored vmw-d.servers.comUninstalling instance vmw-d.servers.com
Uninstalling monitored on vmw-d.servers.com success
Clean global directories vmw-b.servers.comClean directory /usr/local/opengemini/gemini-log/logs on instance vmw-b.servers.comClean directory /usr/local/opengemini/gemini-deploy on instance vmw-b.servers.comClean directory /home/root/data on instance vmw-b.servers.com
Clean global directories vmw-b.servers.com success
Clean global directories vmw-c.servers.comClean directory /usr/local/opengemini/gemini-log/logs on instance vmw-c.servers.comClean directory /usr/local/opengemini/gemini-deploy on instance vmw-c.servers.comClean directory /home/root/data on instance vmw-c.servers.com
Clean global directories vmw-c.servers.com success
Clean global directories vmw-d.servers.comClean directory /usr/local/opengemini/gemini-log/logs on instance vmw-d.servers.comClean directory /usr/local/opengemini/gemini-deploy on instance vmw-d.servers.comClean directory /home/root/data on instance vmw-d.servers.com
Clean global directories vmw-d.servers.com success
Clean global directories vmw-e.servers.comClean directory /usr/local/opengemini/gemini-log/logs on instance vmw-e.servers.comClean directory /usr/local/opengemini/gemini-deploy on instance vmw-e.servers.comClean directory /home/root/data on instance vmw-e.servers.com
Clean global directories vmw-e.servers.com success
Delete public key vmw-b.servers.com
Delete public key vmw-b.servers.com success
Delete public key vmw-c.servers.com
Delete public key vmw-c.servers.com success
Delete public key vmw-d.servers.com
Delete public key vmw-d.servers.com success
Delete public key vmw-e.servers.com
Delete public key vmw-e.servers.com success
Uninstall cluster `gemini-test` successfully
- 卸载前后的对比:
卸载前
[root@vmw-d ~]# ll /data/gemini-data/meta/
总用量 24
-rw-------. 1 root root 32768 12月 23 14:28 raft.db
drwxr-xr-x. 2 root root 6 12月 23 10:24 snapshots
卸载后
[root@vmw-d ~]# ll /data/gemini-data/meta/
ls: 无法访问/data/gemini-data/meta/: 没有那个文件或目录[root@vmw-d ~]# ll /data/gemini-data/data
ls: 无法访问/data/gemini-data/data: 没有那个文件或目录[root@vmw-d ~]# ll /usr/local/opengemini/gemini-log/
总用量 0
[root@vmw-d ~]# ll /usr/local/opengemini/
总用量 0
drwxr-xr-x. 2 root root 6 12月 23 14:29 gemini-log# 注: 即 opengemini/gemini-deploy/* 目录及子目录也被移除
帮助手册
[root@vmw-b go-study]# gemix cluster help
Deploy an openGemini cluster for productionUsage:gemix cluster [command]Available Commands:template Print topology templateinstall Install an openGemini cluster for productionstart Start an openGemini clusterstop Stop an openGemini clusteruninstall Uninstall a specified clusterstatus check cluster statusupgrade upgrade clusterFlags:-h, --help help for clusterUse "gemix cluster [command] --help" for more information about a command.
ts-cli : 官方客户端
ts-cli
: OpenGemini 原生客户端
- OpenGemini
- https://github.com/openGemini/openGemini/releases/tag/v1.2.0 【预编译好的】
https://github.com/openGemini/openGemini/releases/download/v1.2.0/openGemini-1.2.0-linux-amd64.tar.gz 【推荐】
https://github.com/openGemini/openGemini/releases/download/v1.2.0/openGemini-1.2.0-windows-amd64.zip 【推荐】
已提前预编译好:ts-cli
/ts-sql
/ts-store
/ ...
- 克隆-构建-运行 | 首页-开发指南-快速开始 | docs.opengemini.org 【自己用源码编译】
git clone https://github.com/openGemini/openGemini.git
cd openGemini
python3 build.py --clean
单机版的构建结果:
> ls build
> ts-cli ts-meta ts-monitor ts-server ts-sql ts-store
ts-server 是独立运行版
- [vmw-e] 自己安装
ts-cli
下载安装包 openGemini-1.2.0-linux-amd64.tar.gz上传服务器 /root/openGemini-1.2.0-linux-amd64.tar.gz# 废弃: /root/test
mv /root/test /root/test.bakmkdir -p /root/gemini-test
tar -zxvf /root/openGemini-1.2.0-linux-amd64.tar.gz -C /root/gemini-testetc/monitor.confetc/openGemini.confetc/openGemini.singlenode.confetc/weakpasswd.propertiesusr/bin/ts-cliusr/bin/ts-metausr/bin/ts-monitorusr/bin/ts-serverusr/bin/ts-sqlusr/bin/ts-store
ls -la /root/gemini-test
chown -R root:root /root/gemini-testrm /usr/local/bin/ts-cli
ln -s /root/gemini-test/usr/bin/ts-cli /usr/local/bin/ts-cli
# [x] ln -s /root/test/usr/bin/ts-cli /usr/local/bin/ts-cli
初始状态创建管理员账号
- step1 启动openGemini单机或者集群
- step2 创建管理员用户
- 方式1 http curl 请求
> curl -i -XPOST "http://ip:8086/query" -k --insecure --data-urlencode "q=CREATE USER admin WITH PASSWORD 'admin-passwd' WITH ALL PRIVILEGES"
- 方式2 通过ts-cli连接openGemini, 通过客户端创建
[root@vmw-e ~]# ts-cli --host 192.168.101.102 --port 8086
openGemini CLI 0.1.0 (rev-revision)
Please use `quit`, `exit` or `Ctrl-D` to exit this program.
> CREATE USER admin WITH PASSWORD 'Xdddwwp@ssword' WITH ALL PRIVILEGES;
>
> show databases; //错误示范
ERR: unable to parse authentication credentials
> show users //错误示范
ERR: unable to parse authentication credentials
> auth //错误示范
username: password:
ERR: authorization failed
> quit[root@vmw-e ~]# ts-cli --host 192.168.101.102 --port 8086 --username admin --password "Xdddwwp@ssword"
openGemini CLI 0.1.0 (rev-revision)
Please use `quit`, `exit` or `Ctrl-D` to exit this program.
> show users
+-------+-------+--------+
| user | admin | rwuser |
+-------+-------+--------+
| admin | true | false |
+-------+-------+--------+
3 columns, 1 rows in set
>
> create bdp_test;
> show databases;
name: databases
+----------+
| name |
+----------+
| bdp_test |
+----------+
1 columns, 1 rows in set
【注意事项】
- 执行时,需要将命令中的IP地址和端口替换为实际环境中的ts-sql的ip和port,同时设置管理员账号名和密码
- 密码必须由大小写字母、数字、特殊字符组成,长度限制为8-256位字符
- config/weakpasswd.properties为若密码配置文件,默认支持若密码校验,如果设置的密码与配置文件中的密码一致,则视为若密码,不允许使用。
- 密码字符串必须用单引号引起来,验证请求时,请包含单引号。
- 不建议在密码中使用单引号(‘)和反斜杠(\)字符,对于包含这些字符\’的密码,在创建密码和提交身份验证请求时,请使用反斜杠对特殊字符进行转义
出于安全考虑,openGemini的管理员账号在系统内只能创建一次,不能删除,并且不能重命名。
创建管理员账户前,请认真考虑用户名和密码,并做好账号和密码的保存。
ts-cli --host 192.168.101.102 --port 8086 --password "OpenGemini#1658"
- 参考文献
- 初始状态创建管理员账号 - 用户管理 - OpenGemini
- [vmw-e] 使用
# 帮助手册
[root@vmw-e ~]# ts-cli -h
ts-cli is a CLI tool of openGemini.Usage:ts-cli [flags]ts-cli [command]Available Commands:execute Execute a queryhelp Help about any commandimport Import data to openGeminiinteractive Work in interactive modeversion Display the version of openGemini CLIFlags:--database string Database to connect to openGemini.-h, --help help for ts-cli--host string ts-sql host to connect to. (default "localhost")-p, --password string Password to connect to openGemini.--port int ts-sql tcp port to connect to. (default 8086)--precision string Specify the format of the timestamp: rfc3339, h, m, s, ms, u or ns. (default "ns")--socket string openGemini unix domain socket to connect to.--ssl Use https for connecting to openGemini.--unsafeSsl Ignore ssl verification when connecting openGemini by https. (default true)-u, --username string Username to connect to openGemini.Use "ts-cli [command] --help" for more information about a command.[root@vmw-e ~]# ts-cli -host 192.168.101.102 -port 8086
监控体系
Grafana
访问URL
- Opengemini 通过 Gemix 一键安装完成后,即可访问 Grafana
http://{grafana_servers}:3000
默认用户名密码: admin / admin
进程 / 部署路径
[root@vmw-e ~]# ps -ef | grep -i grafana
root 2528 1 0 19:48 ? 00:00:07 bin/grafana-7.5.17/bin/grafana-server --homepath=/usr/local/opengemini/gemini-deploy/grafana-3000/bin/grafana-7.5.17 --config=/usr/local/opengemini/gemini-deploy/grafana-3000/conf/grafana.ini
root 89035 88722 0 21:01 pts/2 00:00:00 grep --color=auto -i grafana[root@vmw-e ~]# pwdx 2528
2528: /usr/local/opengemini/gemini-deploy/grafana-3000
核心配置 : grafana.ini
vim /usr/local/opengemini/gemini-deploy/grafana-3000/conf/grafana.ini# #################### Grafana Configuration Example #####################
#
# Everything has defaults so you only need to uncomment things you want to
# change
# possible values : production, development
; app_mode = production
# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
; instance_name = ${HOSTNAME}
# ################################### Paths ####################################
[paths]
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
#
data = /usr/local/opengemini/gemini-deploy/grafana-3000/data
#
# Directory where grafana can store logs
#
logs = /usr/local/opengemini/gemini-deploy/grafana-3000/log
#
# Directory where grafana will automatically scan and look for plugins
#
plugins = /usr/local/opengemini/gemini-deploy/grafana-3000/plugins
#
#
# folder that contains provisioning config files that grafana will apply on startup and while running.
provisioning = /usr/local/opengemini/gemini-deploy/grafana-3000/provisioning#
# ################################### Server ####################################
[server]
# Protocol (http or https)
; protocol = http
# The ip address to bind to, empty will bind to all interfaces
; http_addr =
# The http port to use
http_port = 3000
# The public facing domain name used to access grafana from a browser
domain = 192.168.101.105
# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
; enforce_domain = false
# The full public facing url
# Log web requests
; router_logging = false
# the path relative working path
; static_root_path = public
# enable gzip
; enable_gzip = false
# https certs & key file
; cert_file =
; cert_key =
# ################################### Database ####################################
[database]# Either "mysql", "postgres" or "sqlite3", it's your choice
; type = sqlite3
; host = 127.0.0.1:3306
; name = grafana
; user = root
; password =
# For "postgres" only, either "disable", "require" or "verify-full"
; ssl_mode = disable
# For "sqlite3" only, path relative to data_path setting
; path = grafana.db
# ################################### Session ####################################
[session]# Either "memory", "file", "redis", "mysql", "postgres", default is "file"
; provider = file
# Provider config options
# memory: not have any config yet
# file: session dir path, is relative to grafana data_path
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana`
# mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
# postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
; provider_config = sessions
# Session cookie name
; cookie_name = grafana_sess
# If you use session in https only, default is false
; cookie_secure = false
# Session life time, default is 86400
; session_life_time = 86400
# ################################### Analytics ####################################
[analytics]
# Server reporting, sends usage counters to stats.grafana.org every 24 hours.
# No ip addresses are being tracked, only simple counters to track
# running instances, dashboard and error counts. It is very helpful to us.
# Change this option to false to disable reporting.
; reporting_enabled = true
# Set to false to disable all checks to https://grafana.net
# for new vesions (grafana itself and plugins), check is used
# in some UI views to notify that grafana or plugin update exists
# This option does not cause any auto updates, nor send any information
# only a GET request to http://grafana.net to get latest versions
check_for_updates = true# Google Analytics universal tracking code, only enabled if you specify an id here
; google_analytics_ua_id =
# ################################### Security ####################################
[security]
# default admin user, created on startup
admin_user = admin
# default admin password, can be changed before first start of grafana, or in profile settings
admin_password = admin# used for signing
; secret_key = SW2YcwTIb9zpOOhoPsMm
# Auto-login remember days
; login_remember_days = 7
; cookie_username = grafana_user
; cookie_remember_name = grafana_remember
# disable gravatar profile images
; disable_gravatar = false
# data source proxy whitelist (ip_or_domain:port separated by spaces)
; data_source_proxy_whitelist =
[snapshots]# snapshot sharing options
; external_enabled = true
; external_snapshot_url = https://snapshots-origin.raintank.io
; external_snapshot_name = Publish to snapshot.raintank.io
# ################################### Users ####################################
[users]# disable user signup / registration
; allow_sign_up = true
# Allow non admin users to create organizations
; allow_org_create = true
# Set to true to automatically assign new users to the default organization (id 1)
; auto_assign_org = true
# Default role new users will be automatically assigned (if disabled above is set to true)
; auto_assign_org_role = Viewer
# Background text for the user field on the login page
; login_hint = email or username
# Default UI theme ("dark" or "light")
; default_theme = dark
# ############## Set Cookie Name for Multiple Instances #######################
[auth]
login_cookie_name = grafana_session_3000# ################################### Anonymous Auth ##########################
[auth.anonymous]# specify organization name that should be used for unauthenticated users
; org_name = Main Org.
# specify role for unauthenticated users
; org_role = Viewer
# ################################### Basic Auth ##########################
[auth.basic]; enabled = true
# ################################### Auth LDAP ##########################
[auth.ldap]; enabled = false
; config_file = /etc/grafana/ldap.toml
# ################################### SMTP / Emailing ##########################
[smtp]; enabled = false
; host = localhost:25
; user =
; password =
; cert_file =
; key_file =
; skip_verify = false
; from_address = admin@grafana.localhost
[emails]; welcome_email_on_sign_up = false
# ################################### Logging ##########################
[log]
# Either "console", "file", "syslog". Default is console and file
# Use space to separate multiple modes, e.g. "console file"
mode = file# Either "trace", "debug", "info", "warn", "error", "critical", default is "info"
; level = info
# For "console" mode only
[log.console]; level =
# log line format, valid options are text, console and json
; format = console
# For "file" mode only
[log.file]
level = info
# log line format, valid options are text, console and json
format = text# This enables automated log rotate(switch of following options), default is true
; log_rotate = true
# Max line number of single file, default is 1000000
; max_lines = 1000000
# Max size shift of single file, default is 28 means 1 << 28, 256MB
; max_size_shift = 28
# Segment log daily, default is true
; daily_rotate = true
# Expired days of log file(delete after max days), default is 7
; max_days = 7
[log.syslog]
; level =
# log line format, valid options are text, console and json
; format = text
# Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used.
; network =
; address =
# Syslog facility. user, daemon and local0 through local7 are valid.
; facility =
# Syslog tag. By default, the process' argv[0] is used.
; tag =
# ################################### AMQP Event Publisher ##########################
[event_publisher]; enabled = false
; rabbitmq_url = amqp://localhost/
; exchange = grafana_events
; #################################### Dashboard JSON files ##########################
[dashboards.json]
enabled = false
path = /usr/local/opengemini/gemini-deploy/grafana-3000/dashboards# ################################### Internal Grafana Metrics ##########################
# Metrics available at HTTP API Url /api/metrics
[metrics]# Disable / Enable internal metrics
; enabled = true
# Publish interval
; interval_seconds = 10
# Send internal metrics to Graphite
; [metrics.graphite]
; address = localhost:2003
; prefix = prod.grafana.%(instance_name)s.
# ################################### Internal Grafana Metrics ##########################
# Url used to to import dashboards directly from Grafana.net
[grafana_net]
url = https://grafana.net
ts-monitor
进程 / 部署路径
[root@vmw-b ~]# ps -ef | grep -i ts-monitor
root 2957 1 0 19:50 ? 00:00:24 bin/ts-monitor --config=conf/ts-monitor.toml
root 112060 2138 0 21:10 pts/0 00:00:00 grep --color=auto -i ts-monitor
[root@vmw-b ~]# pwdx 2957
2957: /usr/local/opengemini/gemini-deploy/ts-monitor
核心配置 : ts-monitor.toml
# vim /usr/local/opengemini/gemini-deploy/ts-monitor/conf/ts-monitor.toml
[monitor]# localhost iphost = "192.168.101.102"# Indicates the path of the metric file generated by the kernel. References openGemini.conf: [monitor] store-path# metric-path cannot have subdirectoriesmetric-path = "/usr/local/opengemini/gemini-log/logs/ts-meta-8091/metric"# Indicates the path of the log file generated by the kernel. References openGemini.conf: [logging] path# error-log-path cannot have subdirectorieserror-log-path = "/usr/local/opengemini/gemini-log/logs/ts-meta-8091"# Data disk path. References openGemini.conf: [data] store-data-dirdisk-path = "/data/gemini-data/data"# Wal disk path. References openGemini.conf: [data] store-wal-diraux-disk-path = "/data/gemini-data/data/wal"# Name of the process to be monitored. Optional Value: ts-store,ts-sql,ts-meta.# Determined based on the actual process running on the local node.process = "ts-store,ts-sql"# the history file reported error-log names.history-file = "history.txt"# Is the metric compressed.compress = false[query]# query for some DDL. Report for these data to monitor cluster.# - SHOW DATABASES# - SHOW MEASUREMENTS# - SHOW SERIES CARDINALITY FROM mstquery-enable = falsehttp-endpoint = "127.0.0.x:8086"query-interval = "5m"# username = ""# password = ""# https-enable = false[report]# Address for metric data to be reported.address = ""# Database name for metric data to be reported.database = "gemini_test"rp = "autogen"rp-duration = "168h"# username = ""# password = ""[logging]format = "auto"level = "info"path = "/usr/local/opengemini/gemini-log/logs/ts-monitor"max-size = "64m"max-num = 30max-age = 7compress-enabled = true
场景:数据节点启用ts-monitor
,上报监控数据到 OpenGemini 监控库
- step0 安装一个 opengemini 数据库实例,并创建监控库
_monitor
最佳实践:单独创建,与 opengemini 正式业务库 独立开,避免产生影响。
此处,我偷个懒,暂复用 正式业务库
192.168.101.102
节点作为上报地址。
create database _monitor;
- step1 节点上编辑
ts-monitor
的配置文件
原配置
[root@vmw-b ~]# vim /usr/local/opengemini/gemini-deploy/ts-monitor/conf/ts-monitor.toml
...[report]# Address for metric data to be reported.address = ""# Database name for metric data to be reported.database = "gemini_test"rp = "autogen"rp-duration = "168h"# username = ""# password = ""...
新配置
[root@vmw-b ~]# vim /usr/local/opengemini/gemini-deploy/ts-monitor/conf/ts-monitor.toml
...[report]# Address for metric data to be reported.address = "192.168.101.102:8086"# Database name for metric data to be reported.# database = "gemini_test"database = "_monitor"rp = "autogen"rp-duration = "168h"username = ""password = ""...
-
step3 重启
ts-monitor
进程 -
step4 登录 opengemini 后,可发现
_monitor
库下有新增的 measurement
# 查看保留策略
# show retention policies on _monitor
name=autogen shardGroupDuration=168h0m0s ...# show measurements on _monitor
err_log
meta
metaRaft
spdy
system# select * from "_monitor"."autogen"."err_log"
err_log
表
system
表