瀚高数据库在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
總結
以上是生活随笔為你收集整理的瀚高数据库在Linux上安装,瀚高数据库和postgresql并存,安装瀚高数据库问题的一种解决方案(APP)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java 七大设计原则 - 依赖倒置原则
- 下一篇: linux基本功系列之more命令实战