ITPub博客

首页 > 数据库 > 国内数据库 > YashanDB数据库托管

YashanDB数据库托管

国内数据库 作者:崖山数据库系统YashanDB 时间:2025-03-12 18:08:12 0 删除 编辑

YashanDB支持将某个单节点数据库或数据库集群托管到指定的集群内。

#注意事项

  • 托管过程需使用 yasboot工具,请先 下载并解压YashanDB安装包获取工具并了解该工具的各命令选项含义及说明。

  • 对于遵照 安装部署执行安装的数据库以及已完成托管的数据库,无需执行托管操作。

#操作步骤

除特殊说明,以下步骤均在yasboot工具所在的环境上操作,且命令中的路径、用户、密码等需更换为实际值。

  1. 执行如下命令,生成服务器配置文件。

    $ ./bin/yasboot package config gen --cluster yashandb -u yashan -p password --ip ip1,ip2,...,ipn --install-path /var/database/yashan
    Copied!

    其中:

    -c,--cluster	集群名称,可以取任意名称
    -u,--username	服务器ssh用户名
    -p,--password	服务器ssh登录密码
    -N,--no-password   如果用户配置了免密,请使用这个参数替代-p参数--ip			部署的IP地址,如果涉及到多个服务器,格式为:ip1,ip2,ip3--port			服务器ssh连接端口
    -i, --install-path	数据库安装路径(HOME目录),可以指定为新规划的HOME目录,必须为空目录
    -t, --yas-type		数据库部署的部署形态:
    * SE:单机部署
    * DE:分布式部署--db             单机db组及节点部署的节点规模,请根据实际主备情况调整此参数
    Copied!

    Note:

    该命令会生成服务器配置文件(hosts.toml)和数据库集群配置文件( 集群名.toml),且会直接替换/home/yashan/intall目录下原有的hosts.toml文件和 集群名.toml(若集群名称一致),托管操作只需使用hosts.toml即可,yashandb.toml可以忽略。

  2. 执行如下命令部署主库,并将yasom和yasagent初始化。

    $ ./bin/yasboot package install -i yashandb-22.2.4.100-linux-x86_64.tar.gz -t hosts.toml
    checking install package...install version: yashandb 22.2.4.100
    host0001 100% [====================================================================]    3s
    update host to yasom...
    Copied!

    其中:

    -i, --install-pkg  软件包文件本地路径
    -t, --toml 服务器配置文件,即hosts.toml
    Copied!
  3. 执行如下命令,生成托管配置模板文件join_demo.toml。

    $ ./bin/yasboot package config join-demo -t SE
    Copied!

    其中:

    -t, --type 待托管数据库集群的部署形态,SE表示单机部署,DE表示分布式部署
    Copied!
  4. 修改托管配置文件。

    如下为托管模板文件各参数描述,请根据实际情况修改模板文件中的参数值:

    cluster = "yashandb"  			--集群名称sys_password = "yasdb_123"  --数据库sys用户的密码yas_type = "SE"  			--部署形态[primary_config]
      manage_ip = "192.168.1.2"  								--主节点IP  yasdb_home = "/opt/yasom/yashandb/yashandb"					--主节点的yasdb_home目录  node_path = "/opt/yasom/yashandb/data/yashandb/db-1-1"		--主节点的yasdb_data目录  node_id = "1-1:1"										--主节点的nodeid[[standby_config]]										--备节点按照主节点的示例修改  manage_ip = "192.168.1.2"
      yasdb_home = "/opt/yasom/yashandb/yashandb"
      node_path = "/opt/yasom/yashandb/data/yashandb/db-1-2"
      node_id = "1-2:1"[[standby_config]]                    --备节点按照主节点的示例修改,若无可删除  manage_ip = "192.168.1.2"
      yasdb_home = "/opt/yasom/yashandb/yashandb"
      node_path = "/opt/yasom/yashandb/data/yashandb/db-1-3"
      node_id = "1-3:1"
    Copied!
  5. 执行如下命令,进行托管操作。

    $ ./bin/yasboot cluster join -t SE --config join_demo.toml
    Copied!

    其中:

    -t, --type 待托管数据库集群的部署形态,SE表示单机部署,DE表示分布式部署
    -c, --config 托管配置文件
    Copied!

    命令执行结果如下所示:

    the cluster status is as follow:|key         |value|------------+------|clusterName |tp|version     |22.2.4.100
    the cluster status is as follow:
     hostid   | node_type | nodeid | pid   | instance_status | database_status | database_role | listen_address | data_path
    -------------------------------------------------------------------------------------------------------------------------------------------------
     host0001 | db        | 1-1:1  | 46689 | open            | normal          | primary       | 192.168.1.2:1688   | /data/yashan/yasdb_data/db-1-1
    ----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------+------------------------------------
    Check success
    Are you sure you to add yasdb tp to yasom[yes/no]: yes
     type | uuid             | name             | hostid | index | status  | return_code | progress | cost
    -------------------------------------------------------------------------------------------------------
     task | e2007922a317a02c | JoinYasdbCluster | -      | tp    | SUCCESS | 0           | 100      | -
    ------+------------------+------------------+--------+-------+---------+-------------+----------+------
    task completed, status: SUCCESS
    Copied!
  6. 执行如下命令,查看数据库状态。

    $ ./bin/yasboot cluster status -c yashandb -d
     hostid   | node_type | nodeid | pid   | instance_status | database_status | database_role | listen_address | data_path
    -----------------------------------------------------------------------------------------------------------------------------------------
     host0001 | db        | 1-1:1  | 46689 | open            | normal          | primary       | 192.168.1.2:1688   | /data/yashan/yasdb_data/db-1-1
    ----------+-----------+--------+-------+-----------------+-----------------+---------------+----------------+----------------------------
    Copied!


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70028812/viewspace-3075597/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
崖山数据库系统YashanDB是深圳计算科学研究院完全自主研发设计的新型数据库系统,融入原创理论,支持单机/主备、共享集群、分布式等多种部署方式,覆盖OLTP/HTAP/OLAP交易和分析混合负载场景,为客户提供一站式的企业级融合数据管理解决方案。

注册时间:2023-04-11

  • 博文量
    722
  • 访问量
    640272