南大通用数据库(gbase 8s) 在Centos7环境 集群安装

国产数据库-达梦

  • 一、环境详情
  • 二、Centos7 参数优化(所有节点)
  • 三、创建gbase用户(所有节点)
  • 四、 安装部署,只在node1 安装即可同步
  • 五、数据库卸载
  • 六、数据库连接与使用

当前安装 在指定版本环境下 测试,仅供参考

一、环境详情

  1. 软件版本

    软件 版本 下载地址
    Centos 7 CentOS Linux release 7.9.2009 (Core) x86 清华镜像站: link
    南大通用 GBase8a_MPP_Cluster-License-9.5.3.14-redhat7.3-x86_64.tar.bz2 兼容mysql 百度网盘 提取码:1234

    南大通用官网:下载

  2. 节点分配

    节点 IP 角色
    node1 192.168.162.221 主机
    node2 192.168.162.222 备机
    node3 192.168.162.223 备机

二、Centos7 参数优化(所有节点)

  1. 关闭防火墙
  • 关闭防火墙: systemctl stop firewalld
  • 禁止开机自启: systemctl disable firewalld
  1. 修改系统最大进程数和最大文件打开数

    vim /etc/security/limits.conf
    
    修改以下内容:
    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 2048
    * hard nproc 4096
    
  2. 修改进程数据限制

    vim /etc/security/limits.d/90-nproc.conf
    修改以下内容:
    * soft nproc 1024
    * soft nproc 2048
    

    查看优化信息

    ulimit -a
    
  3. 查看 RemoveIPC 参数值是否为 yes

    loginctl show-session | grep RemoveIPC 
    systemctl show systemd-logind | grep RemoveIPC 
    

    如果为 yes,则需要修改;如果为 no,则无需继续执行后续步骤

    vim /etc/systemd/logind.conf
    

    将 RemoveIPC 参数值设置为 no,键入“:wq”保存并退出

    vim /usr/lib/systemd/system/systemd-logind.service
    

    将 RemoveIPC 参数值设置为 no,键入“:wq”保存并退出。
    重新加载配置文件,执行以下命令:

    systemctl daemon-reload 
    systemctl restart systemd-logind
    
  4. 关闭 SELINUX

    sestatus
    

    如果系统提示以下信息,说明 selinux 已被禁用:
    SELinux status: disabled

    否则执行以下命令

    sudo vim /etc/selinux/config
    
    # disabled - No SELinux policy is loaded. 
    SELINUX=disabled
    
  5. 同步时间 NTP 服务

  6. 配置系统内核参数

    sudo vim /etc/sysctl.conf 
    
    #增加以下内容:
    kernel.sem = 40960 2048000 40960 20480
    
    #执行生效命令:
    sysctl -p
    

三、创建gbase用户(所有节点)

  1. 用户创建
    groupadd gbase
    useradd -m -d /home/gbase gbase -g gbase 
    passwd gbase
    
  2. 添加普通用户至 sudoer 列表
    root ALL=(ALL) ALL 
    gbase ALL=(ALL) NOPASSWD:ALL
    
  3. 在所有节点创建 gbase 用户免密登录
    mkdir ~/.ssh
    chmod 700 ~/.ssh
    cd /home/gbase/,ssh
    ssh-keygen -t rsa
    ssh-copy-id gbase@192.162.168.221
    ssh-copy-id gbase@192.162.168.222
    ssh-copy-id gbase@192.162.168.223
    

四、 安装部署,只在node1 安装即可同步

  1. 创建数据库目录
    登录 gbase 用户

    mkdir -p /home/gbase/gbase_db
    
  2. 创建上传目录

    mkdir -p /home/gbase/gbase_package
    
  3. 上传文件
    上传 GBase8sV8.8_S3.0.0B69_centos7.8_x86_64.tar.gz 到 /home/gbase/gbase_package

  4. 解压

    cd /home/gbase/gbase_package 
    tar xvf GBase8sV8.8_S3.0.0B69_centos7.8_x86_64.tar.gz
    tar xvf GBase8sV8.8_S3.0.0B69_CentOS_x86_64_om.tar.gz
    
  5. 编辑 yml 文件

    cp /home/gbase/gbase_package/gbase.yml /home/gbase/
    vim /home/gbase/gbase.yml
    
    //填入以下信息,注意yml格式
    gha_server:
      - gha_server1:
          host: 192.168.162.221
          port: 20001
      - gha_server2:
          host: 192.168.162.222
          port: 20001
    dcs:
      - host: 192.168.162.221
        port: 2379
      - host: 192.168.162.222
        port: 2379
      - host: 192.168.162.223
        port: 2379
    datanode:
      - dn1:
          - dn1_1:
              host: 192.168.162.221
              agent_host: 192.168.162.221
              role: primary
              port: 15432
              agent_port: 8005
              work_dir: /home/gbase/data/dn1/dn1_1
          - dn1_2:
              host: 192.168.162.222
              agent_host: 192.168.162.222
              role: standby
              port: 15432
              agent_port: 8006
              work_dir: /home/gbase/data/dn1/dn1_2
          - dn1_3:
              host: 192.168.162.223
              agent_host: 192.168.162.223
              role: standby
              port: 15432
              agent_port: 8006
              work_dir: /home/gbase/data/dn1/dn1_3
    env:
      # cluster_type allowed values: multiple-nodes, single-inst, default is multiple-nodes
      cluster_type: single-inst
      pkg_path: /home/gbase/gbase_package
      prefix: /home/gbase/gbase_db
      version: V8.8_S3.0.0B69
      user: gbase
      port: 22
      third_ssh: false
    # constant:
    #   virtual_ip: 100.0.1.254/24
    
  6. 安装命令

    cd /home/gbase/gbase_package/script
    ./gha_ctl install -p /home/gbase/ -c gbase
    
  7. 查看状态命令

    gha_ctl monitor all -l http://192.168.162.221:2379 -H
    
  8. 启停数据库

    //启动
    ./gha_ctl start all -l http://192.168.162.221:2379
    
    //停止
    ./gha_ctl stop all -l http://192.168.162.221:2379
    

五、数据库卸载

  1. 卸载
    ./gha_ctl uninstall -c gbase8s -l http://192.168.162.221:2379
    
  2. 卸载完成后删除 DCS
    ./gha_ctl destroy dcs -l http://192.168.162.221:2379
    

六、数据库连接与使用

  1. 本地连接
    gsql -d dbname -p port <-U user_name> <-h hostip >
    gsql -d postgres -p 15432
    
    修改密码
    ALTER ROLE user_name IDENTIFIED BY '新密码'
    ALTER ROLE gbase IDENTIFIED BY 'casic@123456'
    
  2. 远程连接
    使用 navicat ,创建连接选择 PostGreSQL 配置

你可能感兴趣的:(#,南大通用数据库,gbase,数据库,数据库,南大通用,Gbase,8s,postgresql)