首页
产品
CLup:PostgreSQL高可用集群平台CData高性能数据库云一体机CBackup数据库备份恢复云平台CPDA高性能双子星数据库机
解决方案
数据库专业技术服务全栈式PostgreSQL解决方案Oracle分布式存储化数据库云
文章
客户及伙伴
中启开源
关于我们
公司简介 联系我们
中启开源
往前插入
往后插入
删除

CBackup软件安装

操作系统安装完成后,CBackup需要安装相关如下软件:

1.安装软件

创建postgresql数据库使用的用户cdbmeta:

  1. [root@cdutest opt]# groupadd -g 568 cdbmeta
  2. [root@cdutest opt]# useradd -u 568 -g 568 -d /opt/cdbmeta -m -s /bin/bash cdbmeta
  3. [root@cdutest opt]# passwd cdbmeta

将上面的软件解压到/opt下面,操作如下:

  1. [root@cdutest opt]tar -xvzf cdbmeta2.2.tar.gz
  2. [root@cdutest opt]tar -xvf python3.6.10_centos7.tar
  3. [root@cdutest opt]xz -d cdagent2.2.2.tar.xz
  4. [root@cdutest opt]xz -d cdcloud2.2.2.tar.xz
  5. [root@cdutest opt]tar -xvf cdagent2.2.2.tar
  6. [root@cdutest opt]tar -xvf cdcloud2.2.2.tar
  7. [root@cdutest opt]# ll
  8. total 377532
  9. lrwxrwxrwx 1 root root 12 Oct 31 17:32 cdagent -> cdagent2.2.2
  10. drwxr-xr-x 9 root root 92 Dec 25 07:38 cdagent2.2.2
  11. -rw-r--r-- 1 root root 88709120 Dec 25 07:03 cdagent2.2.2.tar
  12. drwx------ 7 cdbmeta cdbmeta 4096 Dec 25 07:44 cdbmeta
  13. -rwx--x--x 1 root root 12958045 Dec 25 07:04 cdbmeta2.2.tar.gz
  14. lrwxrwxrwx 1 root root 12 Oct 30 10:25 cdcloud -> cdcloud2.2.2
  15. drwxr-xr-x 9 root root 86 Oct 30 10:27 cdcloud2.2.2
  16. -rw-r--r-- 1 root root 88862720 Dec 25 07:04 cdcloud2.2.2.tar
  17. drwxr-xr-x 6 root root 56 May 28 2020 python3.6
  18. -rwx------ 1 root root 196055040 Dec 25 07:03 python3.6.10_centos7.tar

启动cdbmeta数据库:

  1. [root@cdutest opt]# su - cdbmeta
  2. Last login: Mon Dec 28 04:08:43 CST 2020 on pts/0
  3. [cdbmeta@cdutest ~]$ pg_ctl start
  4. 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
  5. 2020-12-28 04:09:01.096 CST [7900] LOG: listening on IPv4 address "0.0.0.0", port 5432
  6. 2020-12-28 04:09:01.096 CST [7900] LOG: listening on IPv6 address "::", port 5432
  7. 2020-12-28 04:09:01.106 CST [7900] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
  8. 2020-12-28 04:09:01.143 CST [7900] LOG: redirecting log output to logging collector process
  9. 2020-12-28 04:09:01.143 CST [7900] HINT: Future log output will appear in directory "log".
  10. done
  11. server started

配置cdcloud配置文件cdcond.conf:

  1. [root@cdutest opt]# cd /opt/cdcloud/conf/
  2. [root@cdutest conf]# cp example_cdcloud.conf cdcloud.conf
  3. [root@cdutest conf]# vi cdcloud.conf
  4. 格式为key-value 形式
  5. #hm_network=10.197.160.0 #需要手动填写为自己的网段
  6. #agent与服务器之间通信的密码
  7. internal_rpc_pass = cdb_pass_pwd
  8. server_rpc_port = 4242
  9. agent_rpc_port = 4243
  10. db_host = 127.0.0.1
  11. db_port = 5432
  12. db_user = cdbmgr
  13. db_pass = cdbMgr232
  14. db_name = cdbmgr
  15. #http服务用户名与密码
  16. http_user = admin
  17. http_pass = cdb428Csudata #可以自定义密码也可以使用默认密码
  18. http_auth = 1
  19. debug_sql = 0
  20. #websocket的端口
  21. server_ws_port = 4244
  22. agent_ws_port = 4245
  23. agent_ws_token = cdbmgr
  24. session_expired_secs = 1800 #web界面登录超时时间,建议设置成1800s,30分钟
  25. #logger 配置
  26. logger_cfg_filename = logger_cfg.json
  27. logger_name = main
  28. #如果因为安全原因,不允许在web页面上登陆主机,则把disable_web_console设置为1,默认是0即允许
  29. disable_web_console = 0
  30. #设置psql
  31. psql_cmd = /opt/cdbmeta/pgsql-12/bin/psql

启动cdcloud主程序:

  1. [root@cdutest bin]# /opt/cdcloud/bin/cdcloud reg_service
  2. 2020-12-28 04:18:11,521 INFO cdcloud v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
  3. 2020-12-28 04:18:11,521 INFO Start loading configuration ...
  4. 2020-12-28 04:18:11,523 INFO Complete configuration loading.
  5. already register systemd service!
  6. register service sucessfully.
  7. please use: "systemctl start cdbmeta" to start cdbmeta.
  8. [root@cdutest bin]# systemctl start cdcloud
  9. [root@cdutest bin]# systemctl status cdcloud
  10. cdcloud.service - cdcloud
  11. Loaded: loaded (/etc/systemd/system/cdcloud.service; enabled; vendor preset: disabled)
  12. Active: active (running) since Mon 2020-12-28 04:18:28 CST; 6s ago
  13. Process: 8480 ExecStart=/opt/cdcloud/bin/cdcloud start (code=exited, status=0/SUCCESS)
  14. Process: 8477 ExecStartPre=/opt/cdcloud/bin/cdcloud stop (code=exited, status=0/SUCCESS)
  15. Main PID: 8485 (python)
  16. CGroup: /system.slice/cdcloud.service
  17. └─8485 ../pyenv/bin/python cdcloud.pyc start
  18. Dec 28 04:18:27 cdutest systemd[1]: Starting cdcloud...
  19. 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.
  20. Dec 28 04:18:28 cdutest cdcloud[8477]: 2020-12-28 04:18:28,268 INFO Start loading configuration ...
  21. Dec 28 04:18:28 cdutest cdcloud[8477]: 2020-12-28 04:18:28,270 INFO Complete configuration loading.
  22. Dec 28 04:18:28 cdutest cdcloud[8477]: cdcloud not running
  23. 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.
  24. Dec 28 04:18:28 cdutest cdcloud[8480]: 2020-12-28 04:18:28,722 INFO Start loading configuration ...
  25. Dec 28 04:18:28 cdutest cdcloud[8480]: 2020-12-28 04:18:28,724 INFO Complete configuration loading.
  26. Dec 28 04:18:28 cdutest systemd[1]: Started cdcloud

配置cdagent配置文件:

  1. [root@cdutest conf]cp example_cdagent.conf cdagent.conf
  2. [root@cdutest conf]vi cdagent.conf
  3. #格式为 key = value
  4. server_address = 10.197.166.137:4242 #这里的IP地址为cdcloud的主机地址,也就是本机地址。
  5. #agent与服务器之间通信的密码
  6. internal_rpc_pass = cdb_pass_pwd
  7. # raid卡类型
  8. raid_card_type = custom
  9. # 硬盘名映射文件名字
  10. mapping_filename = mapping.json
  11. # 是否使用cdora程序 1为有效 0为无效
  12. is_use_cspd = 1

启动agent服务:

  1. [root@cdutest bin]# pwd
  2. /opt/cdagent/bin
  3. [root@cdutest bin]# ./cdagent reg_service
  4. INFO:root:cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
  5. 2020-12-28 05:04:02,992 INFO cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
  6. INFO:root:Start loading agent_configuration ...
  7. 2020-12-28 05:04:02,992 INFO Start loading agent_configuration ...
  8. INFO:root:Complete agent_configuration loading.
  9. 2020-12-28 05:04:02,993 INFO Complete agent_configuration loading.
  10. already register systemd service!
  11. [root@cdutest bin]# systemctl start cdagent
  12. [root@cdutest bin]# systemctl status cdagent
  13. cdagent.service - cdagent
  14. Loaded: loaded (/etc/systemd/system/cdagent.service; enabled; vendor preset: disabled)
  15. Active: active (running) since Mon 2020-12-28 05:04:23 CST; 3s ago
  16. Process: 13617 ExecStart=/opt/cdagent/bin/cdagent start (code=exited, status=0/SUCCESS)
  17. Process: 13613 ExecStartPre=/opt/cdagent/bin/cdagent stop (code=exited, status=0/SUCCESS)
  18. Main PID: 13626 (python)
  19. CGroup: /system.slice/cdagent.service
  20. └─13626 /opt/cdagent/pyenv/bin/python cdagent.pyc start
  21. Dec 28 05:04:23 cdutest cdagent[13613]: INFO:root:Complete agent_configuration loading.
  22. Dec 28 05:04:23 cdutest cdagent[13613]: 2020-12-28 05:04:23,391 INFO Complete agent_configuration loading.
  23. Dec 28 05:04:23 cdutest cdagent[13613]: cdagent not running
  24. Dec 28 05:04:23 cdutest cdagent[13617]: INFO:root:cdagent v2.2.2 Copyright (c) 2018-2019 HangZhou CSTech.Ltd. All rights reserved.
  25. 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.
  26. Dec 28 05:04:23 cdutest cdagent[13617]: INFO:root:Start loading agent_configuration ...
  27. Dec 28 05:04:23 cdutest cdagent[13617]: 2020-12-28 05:04:23,777 INFO Start loading agent_configuration ...
  28. Dec 28 05:04:23 cdutest cdagent[13617]: INFO:root:Complete agent_configuration loading.
  29. Dec 28 05:04:23 cdutest cdagent[13617]: 2020-12-28 05:04:23,778 INFO Complete agent_configuration loading.
  30. Dec 28 05:04:23 cdutest systemd[1]: Started cdagent

通过浏览器登陆web管理,用户名和密码是cdcond.conf中配置项http_user和http_pass指定的值,默认为 admin/cdb428Csudata。CBackup登陆界面:
CBackup登陆界面