瀚高数据库在Linux上安装,瀚高数据库和postgresql并存,安装瀚高数据库问题的一种解决方案(APP)...

目录

环境

文档用途

详细信息

环境

系统平台:Linux x86-64 Red Hat Enterprise Linux 7

版本:5.6.5

文档用途

本文用于解决在已安装postgresql的服务器上,安装瀚高数据库(cluster版本)或对瀚高数据库进行基本启停等操作时产生的问题。本文提供了其中一种解决方案。

详细信息

安装hgdb5.6.5-cluster-rhel7.x版本,postgresql以postgresql9.2为例

前提:服务器上已安装postgresql9.2,可以远程登录,本地pg_ctl等命令可以正常使用。

下面根据安装步骤展示和解决问题:

1)执行安装命令:

[root@localhost home]# rpm -ivh hgdb5.6.5-cluster-rhel7.x-x86-64-20190815.rpm

Preparing...                        ################################# [100%]

Updating / installing...

1:hgdb-cluster-5.6.5-1.el7         ################################# [100%]

initdb: could not open file "/opt/HighGo5.6.5-cluster/etc/5866" for reading: No such file or directory

Note: Forwarding request to 'systemctl enable hgdb-se5.6.5.service'.

Created symlink from /etc/systemd/system/multi-user.target.wants/hgdb-se5.6.5.service to /usr/lib/systemd/system/hgdb-se5.6.5.service.

Created symlink from /etc/systemd/system/graphical.target.wants/hgdb-se5.6.5.service to /usr/lib/systemd/system/hgdb-se5.6.5.service.

注:由于cluster版本安装时不自动初始化,因此需要手动执行数据库初始化。

2)切换到瀚高数据库用户进行数据库初始化

[root@localhost home]# su - highgo

[highgo@localhost ~]$ initdb

The files belonging to this database system will be owned by user "highgo".

This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".

The default database encoding has accordingly been set to "UTF8".

The default text search configuration will be set to "english".

creating directory /opt/HighGo5.6.5-cluster/data ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 32MB

creating configuration files ... ok

creating template1 database in /opt/HighGo5.6.5-cluster/data/base/1 ... ok

initializing pg_authid ... ok

initializing dependencies ... ok

creating system views ... ok

loading system objects' descriptions ... ok

creating collations ... ok

creating conversions ... ok

creating dictionaries ... ok

setting privileges on built-in objects ... ok

creating information schema ... ok

loading PL/pgSQL server-side language ... ok

vacuuming database template1 ... ok

copying template1 to template0 ... ok

copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections

You can change this by editing pg_hba.conf or using the option -A, or

--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

postgres -D /opt/HighGo5.6.5-cluster/data

or

pg_ctl -D /opt/HighGo5.6.5-cluster/data -l logfile start

3)数据库启动

启动方式一:

[highgo@localhost ~]$ pg_ctl start

server starting

[highgo@localhost ~]$ LOG:  could not bind IPv6 socket: Address already in use

HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.

LOG:  could not bind IPv4 socket: Address already in use

HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.

WARNING:  could not create listen socket for "localhost"

FATAL:  could not create any TCP/IP sockets

问题一:以上发现启动时的端口是potgresql的不是瀚高数据库的。因为postgresql的服务已经在运行了,所以启动报错了。

启动方式二:

[highgo@localhost ~]$ pg_ctl -D /opt/HighGo5.6.5-cluster/data -l logfile start

server starting

[highgo@localhost ~]$ psql highgo highgo

psql: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/tmp/.s.PGSQL.5866"?

问题二:启动成功,但是登录报错。

[highgo@localhost ~]$ ps -ef|grep highgo

root      13547  13367  0 19:26 pts/2    00:00:00 su - highgo

highgo    13681  13548  0 19:30 pts/2    00:00:00 grep --color=auto highgo

[highgo@localhost ~]$ pg_ctl -D /opt/HighGo5.6.5-cluster/data -l logfile stop

pg_ctl: PID file "/opt/HighGo5.6.5-cluster/data/postmaster.pid" does not exist

Is server running?

[highgo@localhost ~]$ pg_ctl stop

pg_ctl: PID file "/opt/HighGo5.6.5-cluster/data/postmaster.pid" does not exist

Is server running?

查询瀚高数据库进程,不存在;停止瀚高数据库的服务,报错:服务未运行。

查看安装目录下初始化生成的data目录结构和postgresql.conf文件,发现不是瀚高数据库的正常目录结构;

根据初始化生成的data目录判断是数据库初始化时使用了postgresql9.2的初始化命令生成的。

4)删除数据库初始化的data目录,重新进行初始化

[highgo@localhost HighGo5.6.5-cluster]$ rm -rf data

[highgo@localhost HighGo5.6.5-cluster]$ cd bin

[highgo@localhost bin]$ pwd

/opt/HighGo5.6.5-cluster/bin

#为确保是使用瀚高数据库命令进行的初始化,因此在bin目录下使用./initdb初始化数据库

[highgo@localhost bin]$ ./initdb

The files belonging to this database system will be owned by user "highgo".

This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".

The default database encoding has accordingly been set to "UTF8".

The default text search configuration will be set to "english".

Data page checksums are disabled.

Data encryption is disabled.

creating directory /opt/HighGo5.6.5-cluster/data ... ok

creating subdirectories ... ok

selecting default max_connections ... 100

selecting default shared_buffers ... 128MB

selecting dynamic shared memory implementation ... posix

creating configuration files ... ok

running bootstrap script ... ok

performing post-bootstrap initialization ... ok

syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections

You can change this by editing pg_hba.conf or using the option -A, or

--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

./pg_ctl -D /opt/HighGo5.6.5-cluster/data -l logfile start

查看安装目录下初始化生成的data目录结构和postgresql.conf文件,发现是瀚高数据库的正常目录结构,继续进行以下操作。

5)数据库启动

启动方式一:

[highgo@localhost bin]$ pg_ctl start

server starting

[highgo@localhost bin]$ LOG:  unrecognized configuration parameter "dynamic_shared_memory_type" in file "/opt/HighGo5.6.5-cluster/data/postgresql.conf" line 131

LOG:  unrecognized configuration parameter "max_worker_processes" in file "/opt/HighGo5.6.5-cluster/data/postgresql.conf" line 188

LOG:  unrecognized configuration parameter "wal_log_hints" in file "/opt/HighGo5.6.5-cluster/data/postgresql.conf" line 219

LOG:  unrecognized configuration parameter "fwd_white_list" in file "/opt/HighGo5.6.5-cluster/data/postgresql.conf" line 713

FATAL:  configuration file "/opt/HighGo5.6.5-cluster/data/postgresql.conf" contains errors

问题三:以上启动报错。

启动方式二:

[highgo@localhost bin]$ ./pg_ctl -D /opt/HighGo5.6.5-cluster/data -l logfile start

waiting for server to start.... done

server started

#以上启动成功

[highgo@localhost bin]$ ps -ef|grep highgo

root      13547  13367  0 19:58 pts/2    00:00:00 su - highgo

highgo    13548  13547  0 19:58 pts/2    00:00:00 -bash

highgo    47810      1  0 21:30 pts/2    00:00:00 /opt/HighGo5.6.5-cluster/bin/postgres -D /opt/HighGo5.6.5-cluster/data

highgo    47816  47810  0 21:30 ?        00:00:00 postgres: checkpointer process

highgo    47817  47810  0 21:30 ?        00:00:00 postgres: writer process

highgo    47818  47810  0 21:30 ?        00:00:00 postgres: wal writer process

highgo    47819  47810  0 21:30 ?        00:00:00 postgres: autovacuum launcher process

highgo    47820  47810  0 21:30 ?        00:00:00 postgres: stats collector process

highgo    47821  47810  1 21:30 ?        00:00:00 postgres: bgworker: pg_wait_sampling collector

highgo    47823  47810  1 21:30 ?        00:00:00 postgres: bgworker: performance diagnosis collector

highgo    47824  47810  0 21:30 ?        00:00:00 postgres: bgworker: logical replication launcher

highgo    47835  13548  0 21:31 pts/2    00:00:00 ps -ef

highgo    47836  13548  0 21:31 pts/2    00:00:00 grep --color=auto highgo

#以上查询瀚高数据库进程,正常

根据以上两种启动方式的不同,判断直接执行pg_ctl start是使用的postgresql9.2的启动命令;在bin下./pg_ctl start是使用的当前目录下的命令;因此以下的操作在bin下./执行。

6)数据库登录

[highgo@localhost bin]$ ./psql -U highgo

psql (5.6.5)

PSQL: Release 5.6.5

Connected to:

HighGo Database V5.6 Enterprise Edition Release 5.6.5 - 64-bit Production

Type "help" for help.

highgo=#

#因为配置文件密码属性是trust,因此不需要输密码直接登录成功。

7)修改数据库参数,trust改成md5

[highgo@localhost data]$ vi pg_hba.conf

# "local" is for Unix domain socket connections only

local   all             all                               md5

# IPv4 local connections:

host    all             all             0.0.0.0/0            md5

更多详细信息请登录【瀚高技术支持平台】查看https://support.highgo.com/#/index/docContent/bd77cae40183f644

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在UOS操作系统上安装数据库可以按照以下步骤进行操作: 1. 将数据库压缩包hgdb4.5.2-see-uos20-kunpeng-64-20200930.deb放入/usr/src目录(或其他具有权限的目录),然后使用以下命令安装数据库: ``` dpkg -i hgdb4.5.2-see-uos20-kunpeng-64-20200930.deb ``` [1] 2. 上传备份脚本到服务器,并根据需要修改脚本内容,包括数据库端口、备份保留数量、归档文件路径、数据文件路径、备份路径和数据库名称等参数。然后修改脚本的权限为可执行: ``` chmod +x hgdb_backup_for_linux.sh ``` [2] 3. 在数据库中配置插件pg_stat_statements以便采集数据库信息。可以在HGWatcher目录下创建一个名为getDBlist.sh的文件,内容如下: ``` [DATABASE1] # psql的路径 PSQL=/usr/pgsql-10/bin/psql # PostgreSQL安装路径 PGDATAPATH=/var/lib/pgsql/10/data # PostgreSQL使用的端口 PGPORT=5432 # 当前数据库的IP,默认使用127.0.0.1,需要设置psql -h 127.0.0.1可以直接登录数据库 PGHOST=127.0.0.1 # 登录数据库的用户,需要使用数据库的超级用户 PGUSER=postgres # 数据库软件的安装或管理用户,如有误,需要手动修改。 OSUSER=postgres # 当前所有创建的数据库,如果获取到的数据库不需要监控,可以直接删除 PGDATABASE=postgres,benchmarksql # 数据库是否可以不使用密码直接登录,1表示可以,0表示不可以,需要配置数据库,使其在本地可以不使用密码直接登录 DirectAccess=1 [ENDDATABASE1] ``` [3] 请根据上述步骤进行操作,即可在UOS操作系统上安装数据库。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [统信UOS操作系统在Linux安装数据库](https://blog.csdn.net/m0_49419441/article/details/109842391)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Linux数据库安装步骤(HGDB4.7.6)](https://blog.csdn.net/Auspicious_air/article/details/89707203)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值