我在Redhat 7.1上安装了postgresql数据库,并决定将数据库移动到逻辑卷内的ISCSI设备(LUN)上,并安装在机器的起始位置(xfs格式)。 挂载点是/ var / lib / pgsql 在服务器启动时,postgresql.service处于失败状态。 在messages.log中: systemd: mounting /var/lib/pgsql starting PostgreSQL database server kernel sdv: unknown partition table sd 2:0:0:0: [sdb] attached SCSI disk xfs (dm-4): Mounting V4 Filesystem postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty postgresql.service: control process exited, code=exited status=1 Failed to start PostgreSQL database server. 当我login服务器时,如果它尝试手动启动数据库:systemctl start postgresql – […]
显然,我应该把postgresql.conf放在一个单独的目录下,根据这个 : # Note that recovery.conf must be in $PGDATA directory. # It should NOT be located in the same directory as postgresql.conf 有什么特别的原因吗? 我已经看到两个系统在两个$ PGDATA目录中似乎工作正常。
在一个JAVA应用程序的Ubuntu 14.04服务器上,我们得到Postgres太多的Open文件错误(使用Postgresql 9.5)。 我们在/etc/security/limits.conf中设置以下内容 * soft nofile 16384 * hard nofile 16384 root soft nofile 16384 root hard nofile 16384 postgres soft nofile 16384 postgres hard nofile 16384 还要在/etc/sysctl.conf中设置以下内容 kern.maxfiles=20480 kern.maxfilesperproc=18000 另外请以Postgres用户身份运行时查看以下结果: -> ulimit -Hn 16384 -> ulimit -Sn 16384 -> cat /proc/sys/fs/file-max 100268 在重新启动服务器并检查Postgres 100268的ulimit。但在检查postgres进程下的打开文件的限制仍然是1024和4096 # cat /proc/1072/limits Max open files 1024 4096 files […]
我正在设置一个cron作业来为postgresql数据库做一些例行维护。 脚本如下: #!/bin/sh dbname="dbname" username="postgres" psql -d $dbname -U $username << EOF delete from links_link where submitted_on > now() – interval'4 days'; EOF 但是,当通过crontab运行,这将失败,因为我没有提供用户postgres的密码。 我的问题是:如何在shell脚本中包含用户postgres的密码? 这会让我起来,跑得快。 其次,如何通过不必在脚本中明确添encryption码来提高安全性? 如果有人以前设置过这种东西,他们的经验是最受欢迎的。 提前致谢。
我需要从旧服务器导入PostgresSql数据库到新的Amazon RDS。 我创build了一个数据库转储文件,通过pgAdmin连接到我的RDS,并开始导入pgAdmin控制台( \i dump_file.sql )。 一切似乎工作,但它真的很慢,似乎被困在同一行几个小时..我打开RDS监视器,我看到以下内容: 所以看起来好像有写操作符(但为什么这么less)和一些CPU使用率,但它看起来像它使用真正的低百分比的能力。 另外,我还详细地检查了磁盘使用情况,并且磁盘缩小了,所以它的真实写入,例如没有卡住,只是非常慢。 我能做些什么来更快地导入我的数据库? 为什么这么慢? 为什么它使用这么小的CPU和写操作? 感觉RDS并没有充分发挥其潜力 PS我的DB是大约10Gb的大小。
我试图按照这个指南,允许远程连接postgres http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html 目前我遇到了防火墙的问题。 我有它的设置,所以我有一个/tmp/v4 ,我可以修改,只是恢复我的防火墙规则。 我已经尝试了2个设置。 本指南的build议: -A INPUT -p tcp -s 0/0 –sport 1024:65535 -d 00.000.000.00 –dport 5432 -m state –state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -p tcp -s 00.000.000.00 –sport 5432 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT 当我使用这个设置并运行nc ipofserver 5432我得到Ncat: connection timed out 如果我尝试设置 -I INPUT -p tcp -s […]
我在FreeBSD上运行一个使用PostgreSQL,Nginx和UWSGI的python应用程序。 UWSGI我与SupervisorD一起pipe理。 我的/etc/rc.conf如下所示: … postgresql_enable="YES" nginx_enable="YES" supervisord_enable="YES" SupervisorD启动了几个不同的UWSGI进程,但是他们的configuration文件几乎看起来像这样: [program:uwsgi] command=/usr/local/bin/uwsgi –ini /opt/site/uwsgi/site.ini autostart=True autorestart=True user=example stopsignal=INT redirect_stderr=True stdout_logfile=/opt/site/log/uwsgi.log stdout_logfile_maxbyte=5MB stdout_logfile_backups=10 priority=300 一切正常开始。 然而,我遇到了一个问题,当服务器重新启动时,SupervisorD在PostgreSQL启动完成之前启动了UWSGI,这导致了一个错误。 有没有一种方法可以确保我的UWSGI进程在PostgreSQL完全启动之前不会启动? 如果更容易忽略UWSGI,并告诉FreeBSD甚至在PostgreSQL准备好之前不要启动SupervisorD,那么我很好。 或者我应该以某种方式开始用SupervisorDpipe理PostgreSQL,并处理所有内容?
我在Ubuntu 14.04的同一台主机上安装了PostgreSQL 9.4和9.5。 我的问题是: 当我运行service postgresql start|stop ,两个版本开始/停止。 但我想控制哪一个做。 当我使用psql连接到PostgreSQL时,它总是连接到9.4。 但是我想控制要执行的服务器。 我知道我可以通过不同的端口连接,54为9.4和5433为9.5。 但是我想通过peer auth来连接,就是通过Unix套接字。 我设法find了上述两个问题的线索,但还没有解决我的问题: 我发现一个命令pg_ctlcluster可能会做的工作,但我不知道如何指定正确的参数,例如,群集名称。 我怎么弄出来的? 或者你有其他的方式? Unix套接字可以通过unix_socket_directories = '/var/run/postgresql' 。 但是两个版本都有相同的configuration目录,其中有不同版本的子目录9.4-main.pg_stat_tmp 9.4-main.pid 9.5-main.pg_stat_tmp 9.5-main.pid 。 当我做psql -h /var/run/postgresql ,它只是连接到旧的9.4版本。 谁能帮忙? 谢谢!
我有一个运行在pg_hba.conf的centos上的pgsql9.4服务器来接受来自特定范围的IP的md5连接。 对IP进行编辑后,我的pg_hba.conf文件如下所示: # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all ident # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident # Allow replication connections from localhost, by a user with the # replication privilege. #local replication […]
我在Debian 8 Jessie上为我的NGINXnetworking服务器成功configuration了Letsencrypt。 现在我已经安装了Postgresql 9.4,并希望使用LE证书(在/etc/letsencrypt/live/mydomain/com/… )来进行SSL连接。 我已经将path设置为证书和configuration文件中的密钥( /etc/postgresql/9.4/main/postgresql.conf )。 当我尝试通过pg_ctlcluster重新启动Postgres时,可以pg_ctlcluster ,由于证书的Permission denied ,因此失败。 我知道Postgresql与用户postgres运行,并且此用户不能访问此目录。 我如何解决这个干净的方式?