Skip to content

toplingdb 使用 grafana prometheus 展示监控数据

mytrygithub edited this page Mar 9, 2022 · 1 revision
  • 请勿在已有 grafana 和 prometheus 服务的主机上执行脚本。
  • 操作系统支持centos 8 和阿里云 ecs 系统,其他系统未测试。

1、安装 grafana prometheus

参考文档:https://github.com/topling/todis-grafana-install-shell/blob/main/README.md

下载

git clone https://github.com/topling/todis-grafana-install-shell.git
cd todis-grafana-install-shell
wget "https://github.com/topling/todis-grafana-install-shell/releases/download/download_file/download.tar.gz"
tar xf download.tar.gz

修改配置文件 config.sh

这里 server_config 没有注释表示使用 server_config 中的配置内容。

function server_config() {
    #server config
    todis_host=localhost
    todis_port=8000
    prometheus_port=9090
    prometheus_listen_port=9090
    prometheus_host=localhost
    grafana_host=localhost
    grafana_port=3000
}

server_config
#local_config
#grafana_install_config
#toplingdb_config
#dell1_config
#oauth_config

执行安装命令

sh install.sh

2、编译 toplingdb

下载

git clone https://github.com/topling/toplingdb.git

编译

sudo yum -y install git libaio-devel gcc-c++ gflags-devel zlib-devel bzip2-devel
cd toplingdb
make -j`nproc` db_bench DEBUG_LEVEL=0

3、运行 db_bench

  • 注意都是toplingdb目录下操作

创建 db_bench 目录

mkdir /root/toplingdb_data

配置 web 页面

cp sideplugin/rockside/src/topling/web/{style.css,index.html} /root/toplingdb_data
cp sideplugin/rockside/sample-conf/lcompact_community.yaml .

修改配置

  • 端口:注意需要和 grafana 中 todis_port 端口对应
  • db 目录:存储数据的目录,注意空间大小

lcompact_community.yaml中

listening_ports: '8000'
document_root: /root/toplingdb_data
path: /root/toplingdb_data/strings

设置链接路径

export LD_LIBRARY_PATH=`find sideplugin -name lib_shared`

运行

  • 再次启动时注意删除之前遗留的db目录文件 rm -rf /root/toplingdb_data/strings/*
./db_bench -json lcompact_community.yaml -num 10000000 -disable_wal=true -value_size 2000 -benchmarks=fillrandom,readrandom -batch_size=10

4、查看 grafana 页面

http://todis-host:3000/

string类型的内容和企业版相同,其他未设置。