当前位置: 代码网 > it编程>编程语言>Java > centos虚拟机部署opengauss数据库详细图文教程

centos虚拟机部署opengauss数据库详细图文教程

2024年12月13日 Java 我要评论
一、基本信息1、虚拟机安装的centos版本2、opengauss版本地址:https://opengauss.org/zh/download/3、opengauss和gaussdb的区别高斯数据库(

一、基本信息

1、虚拟机安装的centos版本

2、opengauss版本

地址:https://opengauss.org/zh/download/

3、opengauss和gaussdb的区别

高斯数据库(gaussdb)是云数据库,需要购买。
opengaussdb是开源数据库,可以免费安装部署。

二、安装步骤

1、服务器创建目录

/srv/yutu/opengauss

并授权

chmod -r 775 /srv/yutu/opengauss
将下载的压缩文件上传到该目录下

2、解压

tar -zxvf opengauss-all-6.0.0-centos7-x86_64.tar.gz
下面的解压文件是上面的解压操作后得到的
tar -zxvf opengauss-om-6.0.0-centos7-x86_64.tar.gz

3、编辑/etc/profile文件,在末尾加上ulimit -c unlimited,然后重新加载该文件

source /etc/profile

4、关闭防火墙

systemctl stop firewalld

5、配置python环境

yum install python3.6*
如果报错可以配置yum源

6、验证python环境

7、linux中权限最大的用户是root,gauss数据库官方默认以dbgrp为用户组,omm为用户。

8、进入/srv/yutu/opengauss/script 目录下,创建clusterconfig.xml文件

<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 整体信息 -->
  <cluster>
  <!-- 数据库名称 -->
    <param name="clustername" value="opengauss" />
  <!-- 数据库节点名称(hostname) -->
    <param name="nodenames" value="localhost.localdomain" />
  <!-- 节点ip,与nodenames一一对应 -->
    <param name="backip1s" value="192.168.44.129"/>
  <!-- 数据库安装目录-->
    <param name="gaussdbapppath" value="/opt/huawei/install/app" />
  <!-- 日志目录-->
    <param name="gaussdblogpath" value="/var/log/omm" />
  <!-- 临时文件目录-->
    <param name="tmpmppdbpath" value="/opt/huawei/tmp" />
  <!--数据库工具目录-->
    <param name="gaussdbtoolpath" value="/opt/huawei/install/om" />
  <!--数据库core文件目录-->
    <param name="corepath" value="/opt/huawei/corefile"/>
  <!-- opengauss类型,此处示例为单机类型,“single-inst”表示单机一主多备部署形态-->
    <param name="clustertype" value="single-inst"/>
  </cluster>
  <!-- 每台服务器上的节点部署信息 -->
  <devicelist>
      <!-- node1上的节点部署信息 -->
      <device sn="1000001">
          <!-- node1的hostname -->
          <param name="name" value="localhost.localdomain"/>
          <!-- node1所在的az及az优先级 -->
          <param name="azname" value="az1"/>
          <param name="azpriority" value="1"/>
          <!-- node1的ip,如果服务器只有一个网卡可用,将backip1和sship1配置成同一个ip -->
          <param name="backip1" value="192.168.44.129"/>
          <param name="sship1" value="192.168.44.129"/>
          <!--dbnode-->
          <param name="datanum" value="1"/>
          <!--dbnode端口号-->
          <param name="dataportbase" value="26000"/>
          <!--dbnode主节点上数据目录,及备机数据目录-->
          <param name="datanode1" value="/opt/huawei/install/data/db1"/>
          <!--dbnode节点上设定同步模式的节点数-->
          <!--><param name="datanode1_syncnum" value="0"/><-->
      </device>
  </devicelist>
</root>

保存后退出

9、执行vim /etc/profile命令打开profile文件,添加如下命令:

export ld_library_path=/srv/yutu/opengauss/script/gspylib/clib:$ld_library_path
export gphome=/opt/huawei/install/om
export path=$gphome/script/gspylib/pssh/bin:$gphome/script:$path
export ld_library_path=$gphome/script/gspylib/clib:$ld_library_path
export ld_library_path=$gphome/lib:$ld_library_path
export pythonpath=$gphome/lib

保存退出

source /etc/profile

10、执行预安装

/srv/yutu/opengauss/script该目录下进行

./gs_preinstall -u omm -g dbgrp -x ./clusterconfig.xml

通过opengauss提供的gs_checkos工具来检查系统状态

到这里就预安装结束

11、正式安装

切换到omm用户

在执行过程中,用户需根据提示输入数据库的密码,密码具有一定的复杂度,为保证用户正常使用该数据库,请记住输入的数据库密码。

设置的密码要符合复杂度要求:

最少包含8个字符;

不能和用户名和当前密码(alter)相同,或和当前密码反序;

至少包含大写字母(a-z),小写字母(a-z),数字,非字母数字字符(限定为~!@#$%^&*()-_=+|[{}];:,<.>/?)四类字符中的三类字符。

12、启动gauss数据库命令

在omm用户下,执行gs_om -t start命令和gs_om -t stop命令启动或关闭数据库。

gs_om -t start
gs_om -t stop
gs_om -t restart

12、查看gauss数据库信息,使用navicate连接

gs_om -t status --detail

13、使用navicate连接报错

14、修改两个文件pg_hba.conf和postgresql.conf文件

配置文件都在/opt/huawei/install/data/db1目录下

vim /gaussdb/data/db1/pg_hba.conf

host all all 192.168.56.1/32 md5
host all all 0.0.0.0/0 md5

修改文件postgresql.conf

vi /gaussdb/data/db1/postgresql.conf

1.listen_addresses = '*'
2.local_blind_address = '0.0.0.0'
3.将password_encrytion_type前面的#删除,并且将其赋值为0
password_encrytion_type = 0

15、重启数据库

gs_om -t restart
#连接数据库
gsql -d postgres -p 26000
create user test password “test@1234”;
alter role jni sysadmin;

[omm@opengauss root]$ gsql -d postgres -p 26000
opengauss=# create user test with password "test@123";
create role
opengauss=# grant all privileges to test;
alter role
opengauss=# create database hjl owner test;
create database
opengauss=# \l
                          list of databases
   name    | owner | encoding  | collate | ctype | access 
privileges 
-----------+-------+-----------+---------+-------+--------
-----------
 db_tpcc   | test  | sql_ascii | c       | c     | 
 postgres  | omm   | sql_ascii | c       | c     | 
 template0 | omm   | sql_ascii | c       | c     | =c/omm 
          +
           |       |           |         |       | omm=ctc
/omm
 template1 | omm   | sql_ascii | c       | c     | =c/omm 
          +
           |       |           |         |       | omm=ctc
/omm
(4 rows)
[omm@opengauss root]$ gsql -d db_tpcc -p 26000 -u test
password for user test: 

db_tpcc=> create table mytable(firstcol int);
create table
db_tpcc=> insert into mytable values (100);
insert 0 1
db_tpcc=> select * from mytable;
 firstcol 
----------
      100
(1 row)

db_tpcc=> \q

到此结束

总结

到此这篇关于centos虚拟机部署opengauss数据库的文章就介绍到这了,更多相关centos虚拟机部署opengauss数据库内容请搜索代码网以前的文章或继续浏览下面的相关文章希望大家以后多多支持代码网!

(0)

相关文章:

  • 基于Maven pom文件使用分析

    基于Maven pom文件使用分析

    projectmaven 是一个强大的构建和依赖管理工具,pom.xml 文件是 maven 项目的核心配置文件,用于定义项目的构建、依赖关系、插件、目标等。它... [阅读全文]
  • Java8 CompletableFuture异步编程解读

    Java8 CompletableFuture异步编程解读

    completablefuturede介绍java 8 引入了 completablefuture 类,这是 java 异步编程的一个重要进展。completa... [阅读全文]
  • java集合超详细(最新推荐)

    1 - 概述所有的集合类和集合接口都在java.util包下。在内存中申请一块空间用来存储数据,在java中集合就是替换掉定长的数组的一种引用数据类型。2 - 集合与数组的区别长度…

    2024年12月14日 编程语言
  • Mybatis中SQL的执行过程详解

    Mybatis中SQL的执行过程详解

    mybatis 框架sql执行过程数据库操作映射方式mybatis支持两种方式进行数据库操作映射:映射文件:通过xml文件来定义sql语句和映射关系注解方式:通... [阅读全文]
  • IDEA性能优化方法解决卡顿问题

    IDEA性能优化方法解决卡顿问题

    前言我们在使用 intellij idea的时候有时候会觉得卡顿,那么如何在不升级电脑配置的情况下让 intellij idea的性能更好呢?我们可以通过去修改... [阅读全文]
  • java 抽象类示例详解

    一、抽象类概述:我们知道,类用来模拟现实事物。一个类可以模拟一类事物,而某个类的一个实例化对象可以模拟某个属于该类的具体的事物。类中描绘了该类所有对象共同的特性,当一个类中给出的信…

    2024年12月14日 编程语言

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com