磐维数据库panweidb单节点服务器在centos7.9安装(研发环境)

news/2024/7/5 5:17:45

一、系统环境优化

1.1 关闭SELINUX

# 修改配置文件
cat /etc/selinux/config | grep -i SELINUX
SELINUX=disabled

# 关闭SELINUX
setenforce 0

1.2 内核参数优化

vi /etc/sysctl.conf 添加

# panweidb
net.ipv4.tcp_max_tw_buckets = 10000
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_retries1 = 5
net.ipv4.tcp_syn_retries = 5
net.ipv4.tcp_synack_retries = 5
net.ipv4.tcp_retries2 = 12
vm.overcommit_memory = 0
net.ipv4.tcp_rmem = 8192 250000 16777216
net.ipv4.tcp_wmem = 8192 250000 16777216
net.core.wmem_max = 21299200
net.core.rmem_max = 21299200
net.core.wmem_default = 21299200
net.core.rmem_default = 21299200
net.ipv4.ip_local_port_range = 26000 65535
kernel.sem = 250 6400000 1000 25600
net.core.somaxconn = 65535
net.ipv4.tcp_syncookies = 1
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_fin_timeout = 60
kernel.shmall = 1073741824    
kernel.shmmax = 751619276800          
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
vm.extfrag_threshold = 500
vm.overcommit_ratio = 90
vm.swappiness = 0

# 生效
sysctl -p
注意事项: 

1.3 配置资源限制

vi /etc/security/limits.conf 添加

# panweidb
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 655360
* hard nproc 655360
* soft memlock unlimited
* hard memlock unlimited
* soft core unlimited
* hard core unlimited
* soft stack unlimited
* hard stack unlimited

1.4 创建用户omm和组dbgrp

groupadd -g 1101 dbgrp
useradd -g dbgrp -u 1101 -m omm
echo 'O2********1!'|passwd --stdin omm

创建目录
mkdir -p /opt/panweidb

1.5 安装数据库依赖包

注意事项:
1)libnsl 包在BCLinux8.2 系统中需要安装。Centos7 环境和 BC-Linux7.6、BC-Linux7.8环境中不用安装

yum -y install libaio-devel flex bison ncurses-devel glibc-devel patch redhat-lsb-core readline-devel python3 expect* bzip2 libnsl gcc gcc-c++ zlib-devel ncurses-devel expect


1.6 配置python3(集群版要求,单机版可能不需要)

检查python3
下载地址:https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
# 检查 python3 版本,如果为 Python 3.6.9 则满足要求,如果不满足则需进行编译安装
python3 --version

[root@work2 yum.repos.d]# python3 --version
Python 3.6.8
[root@work2 yum.repos.d]# 

# 从下载安装包
tar -zxf Python-3.6.9.tgz
cd Python-3.6.9
./configure --prefix=/opt/python/Python-3.6.9 --enable-shared --enable-optimizations --with-ssl
make -j 12 && make install
ln -s /opt/python/Python-3.6.9/bin/python3 /usr/bin/python3
ln -s /opt/python/Python-3.6.9/bin/python3.6-config /usr/bin/python3-config
cp /opt/python/Python-3.6.9/lib/libpython3.6m.so.1.0 /usr/lib64
chmod -R 755 /usr/lib64/libpython3.6m.so.1.0
ln -s /usr/lib64/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m.so

cat >> /etc/profile <<-EOF
export PYTHON_HOME=/opt/python/Python-3.6.9
export PATH=$PYTHON_HOME/bin:$PATH
EOF

source /etc/profile

二、磐维数据库panweidb安装

  1. 使用omm用户登录到openGauss包安装的主机,解压openGauss压缩包到安装目录(假定安装目录为/opt/panweidb/soft,请用实际值替换)。

    tar -xf PanWeiDB_1.0.0_CentOS7_x86.tar.gz
    tar -jxf PanWeiDB-1.0.0-CentOS-64bit.tar.bz2 -C /opt/panweidb/soft
  2. 假定解压包的路径为/opt/panweidb/soft,进入解压后目录下的simpleInstall。

    cd /opt/panweidb/soft/simpleInstall
    
  3. 执行install.sh脚本安装openGauss。

    sh install.sh  -w "强密码" && source ~/.bashrc
  4. 上述命令中,-w是指初始化数据库密码(gs_initdb指定),安全需要必须设置。

  5. 安装执行完成后,使用ps和gs_ctl查看进程是否正常。

    ps ux | grep gaussdb
    gs_ctl query -D /opt/panweidb/soft/data/single_node

    执行ps命令,显示类似如下信息:

    [omm@work2 simpleInstall]$ ps ux | grep gaussdb
    omm       1576  4.5  2.7 3029804 444624 ?      Ssl  11:13   0:04 /opt/panweidb/soft/bin/gaussdb -D /opt/panweidb/soft/data/single_node
    omm       2591  0.0  0.0 110492   904 pts/1    S+   11:15   0:00 grep --color=auto gaussdb
    [omm@work2 simpleInstall]$ gs_ctl query -D /opt/panweidb/soft/data/single_node
    [2023-05-24 11:16:55.542][3360][][gs_ctl]: gs_ctl query ,datadir is /opt/panweidb/soft/data/single_node 
     HA state:           
            local_role                     : Normal
            static_connections             : 0
            db_state                       : Normal
            detail_information             : Normal
    
     Senders info:       
    No information 
     Receiver info:      
    No information 
    [omm@work2 simpleInstall]$ 
    
    
    连接数据库
    ​
    [omm@work2 ~]$ gsql -d postgres
    gsql ((PanWeiDB(openGauss) 1.0.0 build 9a7e96bc) compiled at 2022-10-15 20:54:36 commit 0 last mr  )
    Non-SSL connection (SSL connection is recommended when requiring high-security)
    Type "help" for help.
    
    PanWeiDB=# 

三、创建和使用数据库

a.创建用户USER
CREATE USER testza IDENTIFIED BY 'she********sa';

b. 使用如下命令创建一个新的表空间testzaq_tbs,并将表空间escspdb_tbs授权给用户testzaq 
CREATE TABLESPACE testza_tbs OWNER testza RELATIVE LOCATION 'tablespace/testza_tbs1';

c. 使用如下命令创建一个新的数据库escspdb,放在使用escspdb_tbs表空间中。
CREATE DATABASE testza WITH TABLESPACE = testza_tbs;

d.授权用户testza访问数据库testza
grant all privileges on database testza to testza;

e.使用以下命令为数据库设置默认的模式搜索路径。
ALTER DATABASE testza SET search_path TO pa_catalog,public;

f.使用如下命令修改数据库表空间
ALTER DATABASE testza SET TABLESPACE testza_tbs;

g.测试数据库连接
gsql -d testza -U testza -W 'she********sa' -r

四、开启远程访问数据库

4.1 修改加密模式

在PostgreSQL数据库目录下的编辑postgresql.conf,修改password_encryption_type 为1,同时支持md5和sha256

password_encryption_type = 1

4.2 开启远程访问

在PostgreSQL数据库目录下的postgresql.conf文件更改此项参数,并且重启数据库生效

listen_addresses = '*'

4.3 开启pg_hba.conf防火墙,放开IP

host    all             all             10.1.161.184/32         sha256

4.4 使用navicat 进行连接测试,反馈成功

参考:单节点服务器安装单节点服务器安装 创建用户组dbgroup。groupadd dbgroup 创建用户组dbgroup下的普通用户omm,并设置普通用户omm的密码,密码建议设置为omm@123。useradd -g dbgroup omm passwd omm 使用omm用户登录到openGauss包安装的主机,解压openGauss压缩包到安装目录(假定安装目录为/opt/software/openGauss,请用实际值替换)。tar -jxf openGauss-x.x.x-操作系统-64bit.tar.bz2 -C /opt/software/openGauss 假定解压包的路径为/opt/software/openGauss,进入解压后目录下的simpleInstall。cd /opt/software/openGauss/simpleInstall 执行install.sh脚本安装openGauss。sh install.sh -w xxxx 上述命令中,-w是指初始化数据库密码(gs_initdb指定),安全需要必须设置。安装执行完成后,使用ps和gs_ctl查看进程是否正常。ps ux | grep gaussdb gs_ctl query -D /opt/software/openGauss/data/single_node 执行ps命令,显示类似如下信息:omm 24209 11.9 1.0 1852000 355816 pts/0 Sl 01:54 0:33 /opt/software/openGauss/bin/gaussdb -D /opt/software/openGauss/single_node omm 20377 0.0 0.0 119880 1216 pts/0 S+ 15:37 0:00 grep --color=auto gaussdb 执行gs_ctl命令,显示类似如下信息:gs_ctl query ,datadir is /opt/software/openGauss/data/single_node HA state: local_role : Normal static_connections : 0 db_state : Normal detail_information : Normal Senders info: No information Receiver info: No information https://docs.opengauss.org/zh/docs/5.0.0/docs/GettingStarted/%E5%8D%95%E8%8A%82%E7%82%B9%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%AE%89%E8%A3%85.html


http://lihuaxi.xjx100.cn/news/1165489.html

相关文章

汇聚支付APP+技术方案介绍

一、时序图 商户使用汇聚支付的 APP方案&#xff0c;需要两个步骤&#xff1a; 步骤一&#xff1a; 请求汇聚支付的支付接口&#xff0c;https://www.joinpay.com/trade/uniPayApi.action 获取返回的关键参数 rc_Result。 步骤二&#xff1a; 商户 APP 按照微信的 SDK 规范使…

Vicuna:斯坦福开源一个性能相当于90%ChatGPT的聊天机器人

自从Meta公司发布LLaMA以来&#xff0c;围绕它微调和开发的模型越来越多&#xff0c;这得益于它的性能和效果&#xff0c;2023年3月份发布的草泥马&#xff08;Alpaca&#xff09;是由Meta的LLaMA 7B微调而来的全新模型&#xff0c;仅用了52k数据&#xff0c;性能约等于GPT-3.5…

Redis7实战加面试题-基础篇(Redis持久化,Redis事务,Redis管道,Redis发布订阅)

Redis持久化 RDB (Redis DataBase) RDB&#xff08;Redis 数据库&#xff09;&#xff1a;RDB 持久性以指定的时间间隔执行数据集的时间点快照。实现类似照片记录效果的方式&#xff0c;就是把某一时刻的数据和状态以文件的形式写到磁盘上&#xff0c;也就是快照。这样一来即使…

Java企业级开发学习笔记(4.1)Spring Boot入门程序

该文章主要为完成实训任务&#xff0c;详细实现过程及结果见【http://t.csdn.cn/Qh554】 文章目录 一、使用Maven方式构建Spring Boot项目1.1 创建Maven项目1.2 添加依赖1.3 创建入口类1.4 创建控制器1.5 运行入口类1.6 访问Web页面1.7 修改访问映射路径1.8 定制启动标语1.8.1 …

python获取tx弹幕数据并制作词云图

前言 大家早好、午好、晚好吖 ❤ ~欢迎光临本文章 知识点介绍: 爬虫基本思路流程 requests模块的使用 pandas读取表格数据 环境介绍: 开发环境: python 3.8 运行代码 pycharm 2022.3 辅助敲代码 模块使用&#xff1a; requests >>> pip install requests pa…

推动解决新能源电车充电不便的难题

安科瑞虞佳豪 新一轮科技革命和产业变革的蓬勃发展&#xff0c;加速了汽车与能源、交通、信息通信等领域的深度融合&#xff0c;汽车产业朝着电动化、智能化、网联化方向前行&#xff0c;新能源汽车产业迎来了前所未有的发展机遇。花生好车紧跟发展潮流和趋势&#xff0c;大力…

目录层次结构中区分不同功能的RPM包,同时只有一份共享的repodata

使用本地的yum源有几个潜在的好处&#xff1a; 更快的下载速度&#xff1a; 本地yum源通常位于本地网络上&#xff0c;因此可以通过局域网快速获取软件包&#xff0c;而不需要依赖互联网连接。这样可以提供更快的下载速度&#xff0c;节省时间和带宽消耗。 离线访问&#xff1…

「实在RPA·电力数字员工」助推电力行业提质增效

一、电力行业数字化转型的重要性: 电力行业作为节能减排的关键&#xff0c;其数字化转型是推动碳达峰、碳中和目标如期实现的重要一环。实现“双碳”目标&#xff0c;能源是主战场&#xff0c;电力是主力军。对此&#xff0c;国家有关部门出台了一系列引导相关产业数字化发展的…