CBackup软件安装
操作系统安装完成后,CBackup需要安装相关如下软件:
- cdagent2.2.2.tar.xz 为agent软件
- cdbmeta2.2.tar.gz CBackup 存储元数据本地PostgreSQL数据库
- python3.6.10_centos7.tar 主程序依赖的Python程序
- cdcloud2.2.2.tar CBackup 主程序软件
1.安装软件
创建postgresql数据库使用的用户cdbmeta:
[root@cdutest opt]# groupadd -g 568 cdbmeta
[root@cdutest opt]# useradd -u 568 -g 568 -d /opt/cdbmeta -m -s /bin/bash cdbmeta
[root@cdutest opt]# passwd cdbmeta
将上面的软件解压到/opt下面,操作如下:
[root@cdutest opt]tar -xvzf cdbmeta2.2.tar.gz
[root@cdutest opt]tar -xvf python3.6.10_centos7.tar
[root@cdutest opt]xz -d cdagent2.2.2.tar.xz
[root@cdutest opt]xz -d cdcloud2.2.2.tar.xz
[root@cdutest opt]tar -xvf cdagent2.2.2.tar
[root@cdutest opt]tar -xvf cdcloud2.2.2.tar
[root@cdutest opt]# ll
total 377532
lrwxrwxrwx 1 root root 12 Oct 31 17:32 cdagent -> cdagent2.2.2
drwxr-xr-x 9 root root 92 Dec 25 07:38 cdagent2.2.2
-rw-r--r-- 1 root root 88709120 Dec 25 07:03 cdagent2.2.2.tar
drwx------ 7 cdbmeta cdbmeta 4096 Dec 25 07:44 cdbmeta
-rwx--x--x 1 root root 12958045 Dec 25 07:04 cdbmeta2.2.tar.gz
lrwxrwxrwx 1 root root 12 Oct 30 10:25 cdcloud -> cdcloud2.2.2
drwxr-xr-x 9 root root 86 Oct 30 10:27 cdcloud2.2.2
-rw-r--r-- 1 root root 88862720 Dec 25 07:04 cdcloud2.2.2.tar
drwxr-xr-x 6 root root 56 May 28 2020 python3.6
-rwx------ 1 root root 196055040 Dec 25 07:03 python3.6.10_centos7.tar
启动cdbmeta数据库:
[root@cdutest opt]# su - cdbmeta
Last login: Mon Dec 28 04:08:43 CST 2020 on pts/0
[cdbmeta@cdutest ~]$ pg_ctl start
waiting for server to start....2020-12-28 04:09:01.095 CST [7900] LOG: starting PostgreSQL 12.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
2020-12-28 04:09:01.096 CST [7900] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-12-28 04:09:01.096 CST [7900] LOG: listening on IPv6 address "::", port 5432
2020-12-28 04:09:01.106 CST [7900] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-12-28 04:09:01.143 CST [7900] LOG: redirecting log output to logging collector process
2020-12-28 04:09:01.143 CST [7900] HINT: Future log output will appear in directory "log".
done
server started
配置cdcloud配置文件cdcond.conf:
[root@cdutest opt]# cd /opt/cdcloud/conf/
[root@cdutest conf]# cp example_cdcloud.conf cdcloud.conf
[root@cdutest conf]# vi cdcloud.conf
格式为key-value 形式
#hm_network=10.197.160.0 #需要手动填写为自己的网段
#agent与服务器之间通信的密码
internal_rpc_pass = cdb_pass_pwd
server_rpc_port = 4242
agent_rpc_port = 4243
db_host = 127.0.0.1
db_port = 5432
db_user = cdbmgr
db_pass = cdbMgr232
db_name = cdbmgr
#http服务用户名与密码
http_user = admin
http_pass = cdb428Csudata #可以自定义密码也可以使用默认密码
http_auth = 1
debug_sql = 0
#websocket的端口
server_ws_port = 4244
agent_ws_port = 4245
agent_ws_token = cdbmgr
session_expired_secs = 1800 #web界面登录超时时间,建议设置成1800s,30分钟
#logger 配置
logger_cfg_filename = logger_cfg.json
logger_name = main
#如果因为安全原因,不允许在web页面上登陆主机,则把disable_web_console设置为1,默认是0即允许
disable_web_console = 0
#设置psql
psql_cmd = /opt/cdbmeta/pgsql-12/bin/psql
启动cdcloud主程序:
[root@cdutest bin]# /opt/cdcloud/bin/cdcloud reg_service
2020-12-28 04:18:11,521 INFO cdcloud v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
2020-12-28 04:18:11,521 INFO Start loading configuration ...
2020-12-28 04:18:11,523 INFO Complete configuration loading.
already register systemd service!
register service sucessfully.
please use: "systemctl start cdbmeta" to start cdbmeta.
[root@cdutest bin]# systemctl start cdcloud
[root@cdutest bin]# systemctl status cdcloud
cdcloud.service - cdcloud
Loaded: loaded (/etc/systemd/system/cdcloud.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-12-28 04:18:28 CST; 6s ago
Process: 8480 ExecStart=/opt/cdcloud/bin/cdcloud start (code=exited, status=0/SUCCESS)
Process: 8477 ExecStartPre=/opt/cdcloud/bin/cdcloud stop (code=exited, status=0/SUCCESS)
Main PID: 8485 (python)
CGroup: /system.slice/cdcloud.service
└─8485 ../pyenv/bin/python cdcloud.pyc start
Dec 28 04:18:27 cdutest systemd[1]: Starting cdcloud...
Dec 28 04:18:28 cdutest cdcloud[8477]: 2020-12-28 04:18:28,268 INFO cdcloud v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
Dec 28 04:18:28 cdutest cdcloud[8477]: 2020-12-28 04:18:28,268 INFO Start loading configuration ...
Dec 28 04:18:28 cdutest cdcloud[8477]: 2020-12-28 04:18:28,270 INFO Complete configuration loading.
Dec 28 04:18:28 cdutest cdcloud[8477]: cdcloud not running
Dec 28 04:18:28 cdutest cdcloud[8480]: 2020-12-28 04:18:28,722 INFO cdcloud v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
Dec 28 04:18:28 cdutest cdcloud[8480]: 2020-12-28 04:18:28,722 INFO Start loading configuration ...
Dec 28 04:18:28 cdutest cdcloud[8480]: 2020-12-28 04:18:28,724 INFO Complete configuration loading.
Dec 28 04:18:28 cdutest systemd[1]: Started cdcloud
配置cdagent配置文件:
[root@cdutest conf]cp example_cdagent.conf cdagent.conf
[root@cdutest conf]vi cdagent.conf
#格式为 key = value
server_address = 10.197.166.137:4242 #这里的IP地址为cdcloud的主机地址,也就是本机地址。
#agent与服务器之间通信的密码
internal_rpc_pass = cdb_pass_pwd
# raid卡类型
raid_card_type = custom
# 硬盘名映射文件名字
mapping_filename = mapping.json
# 是否使用cdora程序 1为有效 0为无效
is_use_cspd = 1
启动agent服务:
[root@cdutest bin]# pwd
/opt/cdagent/bin
[root@cdutest bin]# ./cdagent reg_service
INFO:root:cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
2020-12-28 05:04:02,992 INFO cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
INFO:root:Start loading agent_configuration ...
2020-12-28 05:04:02,992 INFO Start loading agent_configuration ...
INFO:root:Complete agent_configuration loading.
2020-12-28 05:04:02,993 INFO Complete agent_configuration loading.
already register systemd service!
[root@cdutest bin]# systemctl start cdagent
[root@cdutest bin]# systemctl status cdagent
cdagent.service - cdagent
Loaded: loaded (/etc/systemd/system/cdagent.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-12-28 05:04:23 CST; 3s ago
Process: 13617 ExecStart=/opt/cdagent/bin/cdagent start (code=exited, status=0/SUCCESS)
Process: 13613 ExecStartPre=/opt/cdagent/bin/cdagent stop (code=exited, status=0/SUCCESS)
Main PID: 13626 (python)
CGroup: /system.slice/cdagent.service
└─13626 /opt/cdagent/pyenv/bin/python cdagent.pyc start
Dec 28 05:04:23 cdutest cdagent[13613]: INFO:root:Complete agent_configuration loading.
Dec 28 05:04:23 cdutest cdagent[13613]: 2020-12-28 05:04:23,391 INFO Complete agent_configuration loading.
Dec 28 05:04:23 cdutest cdagent[13613]: cdagent not running
Dec 28 05:04:23 cdutest cdagent[13617]: INFO:root:cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
Dec 28 05:04:23 cdutest cdagent[13617]: 2020-12-28 05:04:23,777 INFO cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
Dec 28 05:04:23 cdutest cdagent[13617]: INFO:root:Start loading agent_configuration ...
Dec 28 05:04:23 cdutest cdagent[13617]: 2020-12-28 05:04:23,777 INFO Start loading agent_configuration ...
Dec 28 05:04:23 cdutest cdagent[13617]: INFO:root:Complete agent_configuration loading.
Dec 28 05:04:23 cdutest cdagent[13617]: 2020-12-28 05:04:23,778 INFO Complete agent_configuration loading.
Dec 28 05:04:23 cdutest systemd[1]: Started cdagent
通过浏览器登陆web管理,用户名和密码是cdcond.conf中配置项http_user和http_pass指定的值,默认为 admin/cdb428Csudata。CBackup登陆界面:
目录