准备工作:
操作系统版本:[root@node10 ~]# uname -a
Linux node10 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@node10 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
前提是安装完yashandb数据库:
注意:
安装和启动模式要以集群的方式启动,不能用单实例的方式启动,不然添加不了数据库,要以yasboot工具来启动数据库
版本:
YashanDB Server Personal Edition Release 23.2.1.100 x86_64 - X86 64bit Linux
数据库登录信息:
sys/yashandb_123@172.16.1.10:1688
到官网下载YCM软件:
https://download.yashandb.com/download
下载的版本为:
yashandb-cloud-manager-23.2.1.103-linux-x86_64.tar.gz
将以上文件解压到yashan用户目录下:
tar xf yashandb-cloud-manager-23.2.1.103-linux-x86_64.tar.gz -C /home/yashan/
解压yashandb-client:
[yashan@node10 packages]$ pwd
/home/yashan/ycm/packages
[yashan@node10 packages]$ mkdir yashandb-client-22.2.12.100-linux-x86_64
[yashan@node10 packages]$ tar xf ./yashandb-client-22.2.12.100-linux-x86_64.tar.gz -C ./yashandb-client-22.2.12.100-linux-x86_64
修改YCM部署配置文件:
[yashan@node10 etc]$ pwd
/home/yashan/ycm/etc
[yashan@node10 etc]$ vim deploy.yml
server:
ycm_name: 崖山监控运维平台
ycm_name_en: YashanDB Cloud Manager
product_short_name: 管理平台
product_short_name_en: Management platform
install_path: /home/yashan/ycm #安装目录
system_user: yashan
ycm_port: 9060
prometheus_port: 9061
loki_http_port: 9062
loki_grpc_port: 9063
yasdb_exporter_port: 9064
yas_hcs_api_port: 9065
prometheus_collect_interval: 10
prometheus_data_expired: 180
monit_enable: true
grpc_tls_enable: true
http_tls_enable: false
manage_ip: ""
dbconfig:
driver: "yashandb" # 可填参数:sqlite3,yashandb。默认是sqlite3
url: "sys/yashandb_123@172.16.1.10:1688" # driver为yashandb时,该参数必填。单IP:user/password@ip:port,HA多ip:user/password@ip:port,ip:port,ip:port
libPath: "/home/yashan/ycm/packages/yashandb-client-22.2.12.100-linux-x86_64/lib" # driver为yashandb时,默认为{YCM_INSTALL_PATH}/YCM/tool/yashandb-client/lib
autoMigrate: true
maxOpenConns: 1
client:
install_path: /home/yashan/ycm
system_user: yashan
system_group: yashan
agent_port: 9070
export_port: 9071
user:
superadmin:
# 用户和密码为admin,以下密码为加密后的密文
password: "17521182513677377011312139512002239872235871971452391332822116097549121243198103"
nickname: superman
email:
phone:
token_key: "cod-base-yasom-auth-token-key1"
token_expired: 30
password_expired: 60
retry_times: 5
lock_expired: 3
log:
console: true
level: "INFO"
rotationTime: 7
rotationSize: 10
maxBackupNum: 30
cloud:
yasdb_path: "/home/yashan/yasdb_home/yashandb/23.2.1.100/yashandb-personal-23.2.1.100-linux-x86_64.tar.gz" # 解压好的安装包路径,解压后的安装包 yasdb_path/yashandb*.tar.gz
username: "yashan" # 新增服务器的用户名
usergroup: "yashan" # 新增服务器的用户组
password: "YasPwd123" # 密码
port: 1022 # 连接的端口号
ecs_prefix: "ecs_yasdb_" # 服务器名称前缀
image_prefix: "yashandb-" # 镜像名称前缀
max_show_order_time: 100 # 查询订单的次数
show_order_interval: 6 # 查询订单的时间间隔,单位为s
flavor_cpu: 2 # 过滤ecs规格,CPU核数需要大于flavor_cpu
flavor_memory: 4 # 过滤ecs规格,内存大小需要大于flavor_memory,单位是GB
修改完成以上部署参数后,开始部署安装YCM:
授予rc.local的执行权限:
su - root
[root@node10 ~]# chmod -x /etc/rc.local
开始部署YCM:
[root@node10 ycm]# /home/yashan/ycm/ycm-init deploy --conf="/home/yashan/ycm/etc/deploy.yml"
2024-06-03 21:11:22 INFO deploy/deploy.go:89 yashandb lib path is /home/yashan/ycm/packages/yashandb-client-22.2.12.100-linux-x86_64/lib
2024-06-03 21:11:22 INFO deploy/manage.go:36 conf manager starting...
2024-06-03 21:11:22 INFO deploy/deploy.go:336 beginning install ycm
2024-06-03 21:11:22 INFO filectl/filectl.go:210 get dir owner uid: 1000 success
2024-06-03 21:11:22 INFO execer/exec.go:29 exec: bash -c id -u yashan starting
2024-06-03 21:11:22 INFO filectl/filectl.go:220 get agent uid: 1000 success
2024-06-03 21:11:22 INFO deploy/deploy.go:114 check residual data success, progress:17
2024-06-03 21:11:22 INFO deploy/deploy.go:114 mkdir installpath success, progress:20
2024-06-03 21:11:22 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/scripts/install.sh ycm yashan /home/yashan/ycm/ycm starting
2024-06-03 21:11:44 INFO deploy/deploy.go:127 unzip packages success, progress:35
2024-06-03 21:11:44 INFO deploy/deploy.go:114 mkdir cert path success, progress:75
2024-06-03 21:11:47 INFO deploy/deploy.go:114 generate self signed cert key success, progress:76
2024-06-03 21:11:48 INFO execer/exec_main_with_lib.go:59 execute with library cmd: /home/yashan/ycm/ycm-init deploy --conf=/home/yashan/ycm/etc/deploy.yml --init-db, libPath: /home/yashan/ycm/packages/yashandb-client-22.2.12.100-linux-x86_64/lib
2024-06-03 21:11:49 INFO deploy/deploy.go:89 yashandb lib path is /home/yashan/ycm/packages/yashandb-client-22.2.12.100-linux-x86_64/lib
2024-06-03 21:11:50 INFO deploy/manage.go:36 conf manager starting...
2024-06-03 21:11:50 INFO deploy/deploy.go:390 beginning init yashandb
2024-06-03 21:11:50 INFO deploy/deploy.go:114 generate ycm.yaml success, progress:45
2024-06-03 21:11:50 INFO deploy/deploy.go:114 generate config.ini success, progress:47
2024-06-03 21:11:50 INFO deploy/deploy.go:114 generate prometheus.yml success, progress:48
2024-06-03 21:11:50 INFO deploy/deploy.go:114 generate loki-local-config.yaml success, progress:49
2024-06-03 21:11:50 INFO deploy/deploy.go:114 generate promtail-local-config.yaml success, progress:51
2024-06-03 21:11:50 INFO deploy/deploy.go:114 generate yasdbpasswd.ini success, progress:53
2024-06-03 21:11:59 INFO model/auto_migrate.go:232 auto migrate all of 82 tables success
2024-06-03 21:12:01 WARN alarm/add_default.go:332 query alarm notify strategy is incorrect, just add default, allns: [], err: <nil>
2024-06-03 21:12:01 INFO execer/exec.go:29 exec: cp -f /home/yashan/ycm/ycm/loki/rules/fake/loki-rules.yaml /home/yashan/ycm/ycm/loki/loki-rules.yaml.bak starting
2024-06-03 21:12:01 INFO execer/exec.go:29 exec: cp -f /home/yashan/ycm/ycm/prometheus-2.28.1/rules.yml /home/yashan/ycm/ycm/prometheus-2.28.1/rules.yml.bak starting
2024-06-03 21:12:01 INFO deploy/deploy.go:114 set conf success, progress:64
2024-06-03 21:12:01 INFO deploy/deploy.go:114 set conf success, progress:65
2024-06-03 21:12:01 INFO deploy/deploy.go:114 init db success, progress:70
2024-06-03 21:12:01 INFO execer/exec.go:29 exec: chown -R yashan:yashan /home/yashan/ycm/ycm starting
2024-06-03 21:12:01 INFO deploy/deploy.go:127 chown path success, progress:70
2024-06-03 21:12:01 INFO execer/exec.go:29 exec: chmod 0755 /home/yashan/ycm starting
2024-06-03 21:12:01 INFO deploy/deploy.go:127 chmod path success, progress:75
2024-06-03 21:12:01 INFO deploy/deploy.go:408 beginning start process
2024-06-03 21:12:01 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/ycm/scripts/ycm.sh start starting
2024-06-03 21:12:02 INFO deploy/deploy.go:127 start server success, progress:80
2024-06-03 21:12:02 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/ycm/scripts/yashandb_exporter.sh start starting
2024-06-03 21:12:04 INFO deploy/deploy.go:127 start yashandb_exporter success, progress:85
2024-06-03 21:12:04 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/ycm/scripts/prometheus.sh start starting
2024-06-03 21:12:05 INFO deploy/deploy.go:127 start monitor success, progress:88
2024-06-03 21:12:05 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/ycm/scripts/loki.sh start starting
2024-06-03 21:12:06 INFO deploy/deploy.go:127 start loki success, progress:90
2024-06-03 21:12:06 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/ycm/scripts/promtail.sh start starting
2024-06-03 21:12:08 INFO deploy/deploy.go:127 start promtail success, progress:91
2024-06-03 21:12:08 INFO execer/exec.go:29 exec: bash /home/yashan/ycm/ycm/monit/monitctl reload starting
2024-06-03 21:12:08 INFO deploy/deploy.go:127 reload monit success, progress:95
2024-06-03 21:12:08 INFO deploy/deploy.go:448 success, progress:100
查看YCM配置的自动启动脚本:
cat /etc/rc.local
su yashan -c '/home/yashan/ycm/ycm/monit/bin/monit -c /home/yashan/ycm/ycm/monit/data/monitrc'
查看YCM监听的端口:
[root@node10 ycm]# netstat -lntup | grep ycm
tcp6 0 0 :::9060 :::* LISTEN 2627/ycm
查看相关进程情况:
[yashan@node10 etc]$ ps -ef | grep ycm
root 1271 1236 0 20:43 pts/0 00:00:02 vim ycm-init
yashan 1994 1 1 21:08 ? 00:00:19 /home/yashan/ycm/ycm/monit/bin/monit -c /home/yashan/ycm/ycm/monit/data/monitrc
yashan 2168 1 1 21:11 ? 00:00:20 /home/yashan/ycm/ycm/monit/bin/monit -c /home/yashan/ycm/ycm/monit/data/monitrc
yashan 2627 1 12 21:12 ? 00:03:11 /home/yashan/ycm/ycm/bin/ycm
yashan 2713 1 0 21:12 ? 00:00:00 /home/yashan/ycm/ycm/yashandb_exporter/yashandb_exporter --web.listen-address=:9064 --yashandb.metrics=/home/yashan/ycm/ycm/etc/yasexporter.metrics.yml --yashandb.targets=/home/yashan/ycm/ycm/etc/yasexporter.targets.yml
yashan 2803 1 4 21:12 ? 00:01:08 /home/yashan/ycm/ycm/prometheus-2.28.1/prometheus --config.file=/home/yashan/ycm/ycm/prometheus-2.28.1/prometheus.yml --storage.tsdb.path=/home/yashan/ycm/ycm/data/prometheus --web.enable-admin-api --web.enable-lifecycle --web.listen-address=0.0.0.0:9061 --storage.tsdb.retention.time=180d --log.level=error
yashan 2879 1 1 21:12 ? 00:00:25 /home/yashan/ycm/ycm/loki/loki -config.file=/home/yashan/ycm/ycm/loki/loki-local-config.yaml -log.level=error
yashan 2922 1 5 21:12 ? 00:01:31 /home/yashan/ycm/ycm/promtail/promtail -config.file=/home/yashan/ycm/ycm/promtail/promtail-local-config.yaml -log.level=error
yashan 11360 9188 0 21:38 pts/3 00:00:00 grep --color=auto ycm
WEB界面访问地址:
http://172.16.1.10:9060/#/user/login?redirect=/
登录用户名和密码都是 admin/admin
第一次登录需要修改密码:
key: yashan_12!@#
1.添加主机
略
2.添加数据库
略
注意:
托管yashandb数据库的数据库名称在以下文件中查看:
[yashan@node10 .yasboot]$ cat /home/yashan/.yasboot/yashandb.env
cluster="yashandb"
om_addr="172.16.1.10:1675"
version="23.2.1.100"
same_version=false
base_path="/home/yashan/yasdb_home/yashandb/23.2.1.100"
max_ac_sql_size=209715200
max_ac_sql_rows=1000000