瀚高数据库和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 

你可能感兴趣的:(Highgo,DB)