AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / dba / 问题

问题[centos-7](dba)

Martin Hope
user1068636
Asked: 2021-04-30 16:46:22 +0800 CST

将默认端口号从 5432 更改为 5332 时,为什么会出现 unix domain socket 错误?

  • 1

我成功地按照此处找到的 Centos 7 上的 Postgres 11 安装说明进行操作。我能够成功地创建模式/表并通过端口 5432 将数据插入到数据库中,没有任何问题。

现在我想将默认端口更改为 5332 (或其他,没关系),我做了以下事情:

 vi /var/lib/pgsql/11/data/postgresql.conf

更改了行:

#port = 5432                            # (change requires restart) 

看起来像:

port = 5332                            # (change requires restart) 

然后通过执行以下操作重新启动 postgres 服务:

systemctl restart postgresql-11.service

然后我更改为 postgres 用户:

su - postgres
psql

我收到以下错误消息:

sql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

所以显然在某处还有另一个端口 5432 的引用,但我找不到它。

仅供参考,如果我撤消上面所做的更改(在文件 /var/lib/pgsql/11/data/postgresql.conf 中),那么一切都会在默认端口 5432 上再次完美运行。

我还需要做什么才能让 postgres 在不同的端口上运行?

postgresql-11 centos-7
  • 1 个回答
  • 339 Views
Martin Hope
Heril Muratovic
Asked: 2020-12-27 06:49:29 +0800 CST

MySQL InnoDB Cluster - 使用本地端口添加实例问题

  • 2

我在使用 MySQL Shell 将实例添加到 MySQL InnoDB Cluster 时遇到问题。以下是我已完成的步骤:

  1. 登录到一个 DB-01 节点
  2. 运行命令:mysqlsh
  3. shell.connect('username@ip-address:port');
  4. cluster = dba.createCluster('cluster-name');
  5. 检查集群状态:cluster.status()。这里一切正常。我在集群中有一个实例。
  6. cluster.addInstance('username@ip-address-of-db-02-node:port');
  7. 收到错误。

DB-02 节点的 MySQL 日志包含以下错误:

[Repl] 插件 group_replication 报告:'[GCS] 连接到所有对等点时出错。会员加入失败。本地端口:33061' 2020-12-26T14:40:29.234106Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication 报告:'[GCS] 成员无法加入组。本地端口:33061'

当我尝试将 DB-03 节点添加到集群时也是如此。所有服务器都在同一个 VLAN 中,并且已经使用 mysql shell 进行了配置(所有节点都有相同的用户和通行证)。IP 表服务未启用,SELinux 已禁用。

当我在端口 33061 上尝试从 DB-02 到 DB-01 的 telnet 时,它已打开,但是当我从 DB-01 到 DB-02 运行 telnet 时,连接被拒绝。

有谁知道如何解决这个问题?

mysql-8.0 centos-7
  • 1 个回答
  • 1604 Views
Martin Hope
Steve S
Asked: 2018-04-19 13:22:38 +0800 CST

尝试将 pg_xlog 移动到不同分区后无法重新启动 PostgreSQL

  • 1

我在 CentOS 7 服务器上备份和运行 PostgreSQL 时遇到问题。

一些上下文:在注意到我在服务器的 /root 分区上的存储空间很快耗尽后,我快速挖掘了一下,发现罪魁祸首是 pg_xlog 中的所有文件都没有被删除。由于 /home 有很多可用空间,我选择将 pg_xlog 目录移动到 /home 上的新目录,以便争取足够的时间来解决日志文件未被清除的初始问题。然后,根据我在此处找到的一些建议,我将原始 pg_xlog 设置为指向 /home 分区中新的符号链接。

但这导致 SELinux 出现一些奇怪的错误,即使在 chown-ing 到 postgres:postgres (符号链接和新目录)之后,也不允许 Postgres 从新目录中读取。

由于我并不完全精通 SELinux,因此我决定将日志文件复制回其原始目录并研究物理扩展分区。

但是在重新复制所有文件后,PostgreSQL 将无法启动。错误消息似乎不是很有帮助(至少对我来说不是)。Journalctl -xe 报告:

Apr 19 00:12:29 localhost.localdomain systemd[1]: Unit postgresql.service entered failed state.
Apr 19 00:12:29 localhost.localdomain systemd[1]: postgresql.service failed.
Apr 19 00:12:29 localhost.localdomain polkitd[1105]: Unregistered >Authentication Agent for unix-process:17236:1124444 (system bus name :1.588, object path /org/freedesk
Apr 19 00:12:31 localhost.localdomain abrt-server[17258]: Email address of sender was not specified. Would you like to do so now? If not, 'user@localhost' is to be used
Apr 19 00:12:31 localhost.localdomain abrt-server[17258]: Email address of receiver was not specified. Would you like to do so now? If not, 'root@localhost' is to be us
Apr 19 00:12:31 localhost.localdomain abrt-server[17258]: Sending an e-mail...
Apr 19 00:12:31 localhost.localdomain abrt-server[17258]: Sending a notification email to: root@localhost
Apr 19 00:12:31 localhost.localdomain abrt-server[17258]: Email was sent to: root@localhost
Apr 19 00:12:31 localhost.localdomain postfix/pickup[10305]: AA0676622C: uid=0 from=<user@localhost>
Apr 19 00:12:31 localhost.localdomain postfix/cleanup[17283]: AA0676622C: message-id=<5ad7b4bf.TazSMT+2CbgyTlql%user@localhost>
Apr 19 00:12:31 localhost.localdomain postfix/qmgr[1963]: AA0676622C: from=<[email protected]>, size=45585, nrcpt=1 (queue active)
Apr 19 00:12:31 localhost.localdomain postfix/local[17285]: AA0676622C: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.05, delays=0.04/
Apr 19 00:12:31 localhost.localdomain postfix/qmgr[1963]: AA0676622C: removed

systemctl status postgresql 说:

● postgresql.service - PostgreSQL 数据库服务器 已加载:已加载(/usr/lib/systemd/system/postgresql.service;已启用;供应商预设:已禁用) 活动:自 2018 年 4 月 19 日星期四 00 日起失败(结果:退出代码) :12:29 吃;1 分钟 34 秒前 进程:17252 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE) 进程:17243 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)

4 月 19 日 00:12:28 localhost.localdomain systemd 1:正在启动 PostgreSQL 数据库服务器... 4 月 19 日 00:12:29 localhost.localdomain systemd 1:postgresql.service:控制进程退出,代码=退出状态=1 Apr 19 00 :12:29 localhost.localdomain systemd 1 : 无法启动 PostgreSQL 数据库服务器。Apr 19 00:12:29 localhost.localdomain systemd 1:单元 postgresql.service 进入失败状态。4 月 19 日 00:12:29 localhost.localdomain systemd 1:postgresql.service 失败。

我必须承认我已经束手无策了。任何帮助,即使它只是生成更多有用的错误消息的一种方式,将不胜感激。

编辑:

似乎在 pg_xlog 文件的复制过程中,文件的所有权更改为 root。此后,为了保留权限,我再次使用 rsync 重新复制了这些相同的文件。现在我按照下面评论部分的建议包括 PostgreSQL 日志。PostgreSQL 日志中的错误消息是:

WARNING:  transaction log file "00000001000000470000008D" could not be archived: too many failures
LOG:  archive command failed with exit code 1
DETAIL:  The failed archive command was: false
LOG:  archive command failed with exit code 1
DETAIL:  The failed archive command was: false
LOG:  archive command failed with exit code 1
DETAIL:  The failed archive command was: false
WARNING:  transaction log file "00000001000000470000008D" could not be archived: too many failures
LOG:  database system was interrupted; last known up at 2018-04-18 19:21:53 EAT
PANIC:  could not open file "pg_xlog/000000010000006900000017" (log file 105, segment 23): Permission denied
LOG:  startup process (PID 17256) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted; last known up at 2018-04-18 19:21:53 EAT
PANIC:  could not open file "pg_xlog/000000010000006900000017" (log file 105, segment 23): Permission denied
LOG:  startup process (PID 20020) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted; last known up at 2018-04-18 19:21:53 EAT
FATAL:  the database system is starting up
PANIC:  could not open file "pg_xlog/000000010000006900000017" (log file 105, segment 23): Permission denied
LOG:  startup process (PID 25607) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted; last known up at 2018-04-18 19:21:53 EAT
FATAL:  the database system is starting up
FATAL:  the database system is starting up
LOG:  invalid magic number 0000 in log file 105, segment 23, offset 9617408
LOG:  invalid primary checkpoint record
LOG:  invalid magic number 0000 in log file 105, segment 23, offset 9601024
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
FATAL:  the database system is starting up
LOG:  startup process (PID 28108) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was interrupted; last known up at 2018-04-18 19:21:53 EAT
LOG:  invalid magic number 0000 in log file 105, segment 23, offset 9617408
LOG:  invalid primary checkpoint record
LOG:  invalid magic number 0000 in log file 105, segment 23, offset 9601024
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 28529) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
postgresql centos-7
  • 2 个回答
  • 1579 Views
Martin Hope
Sébastien Clément
Asked: 2018-02-03 11:43:27 +0800 CST

CentOS 7下如何重启PostgreSQL服务器

  • 25

我在 CentOS 7.3 环境下安装了 PostgreSQL 10.1。

服务已启动(postmaster.pid文件存在于 下/var/lib/pgsql/10/data),但我需要重新加载配置或在更改pg_hba.conf.

但是,尝试不同的命令,我得到以下信息:

pg_ctl reload -D /var/lib/pgsql/10/data
bash: pg_ctl: command not found

service postgresql reload
Redirecting to /bin/systemctl reload postgresql.service
Failed to reload postgresql.service: Unit not found.
postgresql centos-7
  • 6 个回答
  • 170680 Views
Martin Hope
cloud_cloud
Asked: 2017-07-19 21:43:57 +0800 CST

无法从具有 MongoDB 复制集的主节点添加另一个节点

  • 0

在 CentOS 7 上。

MongoDB 版本:3.2.15

有两个节点:

  • 节点1
  • 节点2

节点1

/etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 node1
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.100              node1
192.168.0.101              node2

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /mongo-metadata
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1 192.168.0.100  # Listen to local interface only, comment to listen on all interfaces.


security:
  keyFile: /root/keyfile

#operationProfiling:

replication:
  replSetName: rs0

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

节点2

/etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 node2
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.100              node1
192.168.0.101              node2

/etc/mongod.conf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /mongo-metadata
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1 192.168.0.101  # Listen to local interface only, comment to listen on all interfaces.


security:
  keyFile: /root/keyfile

#operationProfiling:

replication:
  replSetName: rs0

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

在 node1 上运行 mongo 命令

mongo
rs.initiate()
use admin
db.createUser(...)
db.auth('admin', '...')
rs.add('node2')

导致错误:

{
    "ok" : 0,
    "errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: node1:27017; the following nodes did not respond affirmatively: node2:27017 failed with No route to host",
    "code" : 74
}

它不能从node1连接到node2吗?有没有关于如何做 mongodb 复制集的官方指南?

mongodb centos-7
  • 1 个回答
  • 5685 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve