瀚高数据库在Linux上安装,瀚高数据库和postgresql并存,安装瀚高数据库问题的一种解决方案(APP)...
目錄
環(huán)境
文檔用途
詳細(xì)信息
環(huán)境
系統(tǒng)平臺(tái):Linux x86-64 Red Hat Enterprise Linux 7
版本:5.6.5
文檔用途
本文用于解決在已安裝postgresql的服務(wù)器上,安裝瀚高數(shù)據(jù)庫(kù)(cluster版本)或?qū)﹀邤?shù)據(jù)庫(kù)進(jìn)行基本啟停等操作時(shí)產(chǎn)生的問題。本文提供了其中一種解決方案。
詳細(xì)信息
安裝hgdb5.6.5-cluster-rhel7.x版本,postgresql以postgresql9.2為例
前提:服務(wù)器上已安裝postgresql9.2,可以遠(yuǎn)程登錄,本地pg_ctl等命令可以正常使用。
下面根據(jù)安裝步驟展示和解決問題:
1)執(zhí)行安裝命令:
[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版本安裝時(shí)不自動(dòng)初始化,因此需要手動(dòng)執(zhí)行數(shù)據(jù)庫(kù)初始化。
2)切換到瀚高數(shù)據(jù)庫(kù)用戶進(jìn)行數(shù)據(jù)庫(kù)初始化
[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)數(shù)據(jù)庫(kù)啟動(dòng)
啟動(dòng)方式一:
[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
問題一:以上發(fā)現(xiàn)啟動(dòng)時(shí)的端口是potgresql的不是瀚高數(shù)據(jù)庫(kù)的。因?yàn)閜ostgresql的服務(wù)已經(jīng)在運(yùn)行了,所以啟動(dòng)報(bào)錯(cuò)了。
啟動(dòng)方式二:
[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"?
問題二:啟動(dòng)成功,但是登錄報(bào)錯(cuò)。
[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?
查詢瀚高數(shù)據(jù)庫(kù)進(jìn)程,不存在;停止瀚高數(shù)據(jù)庫(kù)的服務(wù),報(bào)錯(cuò):服務(wù)未運(yùn)行。
查看安裝目錄下初始化生成的data目錄結(jié)構(gòu)和postgresql.conf文件,發(fā)現(xiàn)不是瀚高數(shù)據(jù)庫(kù)的正常目錄結(jié)構(gòu);
根據(jù)初始化生成的data目錄判斷是數(shù)據(jù)庫(kù)初始化時(shí)使用了postgresql9.2的初始化命令生成的。
4)刪除數(shù)據(jù)庫(kù)初始化的data目錄,重新進(jìn)行初始化
[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
#為確保是使用瀚高數(shù)據(jù)庫(kù)命令進(jìn)行的初始化,因此在bin目錄下使用./initdb初始化數(shù)據(jù)庫(kù)
[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目錄結(jié)構(gòu)和postgresql.conf文件,發(fā)現(xiàn)是瀚高數(shù)據(jù)庫(kù)的正常目錄結(jié)構(gòu),繼續(xù)進(jìn)行以下操作。
5)數(shù)據(jù)庫(kù)啟動(dòng)
啟動(dòng)方式一:
[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
問題三:以上啟動(dòng)報(bào)錯(cuò)。
啟動(dòng)方式二:
[highgo@localhost bin]$ ./pg_ctl -D /opt/HighGo5.6.5-cluster/data -l logfile start
waiting for server to start.... done
server started
#以上啟動(dòng)成功
[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
#以上查詢瀚高數(shù)據(jù)庫(kù)進(jìn)程,正常
根據(jù)以上兩種啟動(dòng)方式的不同,判斷直接執(zhí)行pg_ctl start是使用的postgresql9.2的啟動(dòng)命令;在bin下./pg_ctl start是使用的當(dāng)前目錄下的命令;因此以下的操作在bin下./執(zhí)行。
6)數(shù)據(jù)庫(kù)登錄
[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=#
#因?yàn)榕渲梦募艽a屬性是trust,因此不需要輸密碼直接登錄成功。
7)修改數(shù)據(jù)庫(kù)參數(shù),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
更多詳細(xì)信息請(qǐng)登錄【瀚高技術(shù)支持平臺(tái)】查看https://support.highgo.com/#/index/docContent/bd77cae40183f644
總結(jié)
以上是生活随笔為你收集整理的瀚高数据库在Linux上安装,瀚高数据库和postgresql并存,安装瀚高数据库问题的一种解决方案(APP)...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java 七大设计原则 - 依赖倒置原则
- 下一篇: linux基本功系列之more命令实战