I just want update my Plesk to 12.0.30, but after the update, I cannot access my panel.
The server is on CentOS.
[root#******* ~]# /etc/init.d/psa restart
PSA is down, performing full restart.
Starting psa... Starting sw-engine-fpm: chmod: cannot access `/dev/shm': No such file or directory
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to init lock manager shared memory file: Unable to create new lock manager shared memory storage. Please, try to restart sw-engine service as root.
/bin/bash: line 1: 1209 Aborted /usr/sbin/sw-engine-fpm --fpm-config /etc/sw-engine/sw-engine-fpm.conf -c /usr/local/psa/admin/conf/php.ini
[FAILED]
failed
Starting xinetd service... done
Starting sw-cp-server service... done
Starting mysqld service... done
Starting named service... done
Starting postgresql service... not installed
Starting spamassassin service... not installed
Plesk: Starting Mail Server... already started
Starting psa... Starting sw-engine-fpm: chmod: cannot access `/dev/shm': No such file or directory
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to init lock manager shared memory file: Unable to create new lock manager shared memory storage. Please, try to restart sw-engine service as root.
/bin/bash: line 1: 1316 Aborted /usr/sbin/sw-engine-fpm --fpm-config /etc/sw-engine/sw-engine-fpm.conf -c /usr/local/psa/admin/conf/php.ini
[FAILED]
failed
Starting drwebd service...
# mkdir /dev/shm
# mount -t tmpfs tmpfs /dev/shm
# /etc/init.d/psa start
Solution on vserver Server4you ubuntu 12
Solution (CentOS):
# mkdir /dev/shm
# mount -t tmpfs tmpfs /dev/shm
# /etc/init.d/psa start
Related
I am trying to build a PostgreSQL image in DockerManually becuase I need to add some certain configuration for the database that doesnot exit in the postgres images provided with docker.
I wrote the following dockerfile
FROM alpine:3.7
#update the OS
RUN apk update
#installing alpine software kit
RUN apk add alpine-sdk
RUN apk update \
postgresql-$PG_MAJOR-postgis-$POSTGISV \
postgresql-$PG_MAJOR-postgis-$POSTGISV-scripts \
postgresql-$PG_MAJOR-pgrouting \
postgresql-$PG_MAJOR-pgrouting-scripts \
postgresql-server-dev-$PG_MAJOR
#installing postgresql
RUN apk add postgresql
RUN apk add openrc --no-cache
RUN apk update && apk upgrade
RUN apk add --no-cache --virtual .base_deps build-base openssl-dev zlib-dev libxml2-dev wget gnupg ca-certificates
RUN apk add --no-cache readline-dev glib-lang libssl1.0 postgresql postgresql-client
RUN apk add --update binutils
RUN apk add --no-cache sudo
RUN apk --purge del .base_deps
RUN echo "postgres ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/postgres
RUN chmod 600 /etc/sudoers.d/postgres
RUN sync
#RUN /etc/init.d/postgresql start
#RUN postgres -D /usr/local/pgsql/data
EXPOSE 5432
then I am trying to lunch the dockerfile with interactive shell with
docker run -it processID
then the follwoing command to instantite database
initdb Database
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locales
COLLATE: C
CTYPE: C.UTF-8
MESSAGES: C
MONETARY: C
NUMERIC: C
TIME: C
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.
creating directory Database ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2019-11-18 08:04:06.670 UTC [89] WARNING: no usable system locales were found
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.
Then I am trying to lunch the database using the following command
postgres -D Database
2019-11-18 08:05:27.358 UTC [91] LOG: listening on IPv4 address "127.0.0.1", port 5432
2019-11-18 08:05:27.358 UTC [91] LOG: could not bind IPv6 address "::1": Address not available
2019-11-18 08:05:27.358 UTC [91] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2019-11-18 08:05:27.360 UTC [91] FATAL: could not create lock file "/run/postgresql/.s.PGSQL.5432.lock": No such file or directory
2019-11-18 08:05:27.360 UTC [91] LOG: database system is shut down
I am getting some errors I do not know exactly why? any help would really be appreciated.
I did switch yo docker-compose, and here is an example of the file
version: "3"
services:
# Create a service named db.
db:
# Use the Docker Image postgres. This will pull the newest release.
image: "postgres:12.1-alpine"
# Give the container the name my_postgres. You can changes to something else.
container_name: "theNameOfDockerCompose"
# Setup the username, password, and database name. You can changes these values.
environment:
- POSTGRES_USER=DatabaseName
- POSTGRES_PASSWORD=Password
- POSTGRES_DB=development
# Maps port 54320 (localhost) to port 5432 on the container. You can change the ports to fix your needs.
ports:
- "5432:5432"
# Set a volume some that database is not lost after shutting down the container.
# I used the name postgres-data but you can changed it to something else.
volumes:
- ./postgres-data:/var/lib/postgresql/data
This is file is what I am using now.
But with Dockerfile, I still cannot enable the endpoints to access the dataBase.
Possible Duplicate of postgres-docker-bind-address-ipv6
update listen_addresses = '*' into postgresql/data/postgresql.conf
2019-11-18 08:05:27.360 UTC [91] FATAL: could not create lock file "/run/postgresql/.s.PGSQL.5432.lock": No such file or directory
points to a missing folder. Add
RUN mkdir -p /run/postgresql
to your Dockerfile
In addition, you need to change the listen_addresses = "*" in your postgresql/data/postgresql.conf. Otherwise, your database will be bound to localhost in your container and you will not be able to access it from anywhere except within that particular container. You can see that in your logs here
2019-11-18 08:05:27.358 UTC [91] LOG: listening on IPv4 address "127.0.0.1", port 5432
for the localhost binding. In addition, this will fix the following error message in your log
2019-11-18 08:05:27.358 UTC [91] LOG: could not bind IPv6 address "::1": Address not available
in which postgres failed to the bind for ipv6.
EDIT-2
I found out that the database doesn't even start after making the file location change.
This is with the default file location:
$pg_isready
/var/run/postgresql:5432 - accepting connections
$pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.5 main 5432 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log
pg_lsclusters output is green.
After the file location has changed on postgresql.conf:
$pg_isready
/var/run/postgresql:5432 - no response
$pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.5 main 5432 down root /mnt/Data/postgresdb/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log
Here the output is red.
Following this post here, I tried to start the cluster manually:
$pg_ctlcluster 9.5 main start
Warning: the cluster will not be running as a systemd service. Consider using systemctl:
sudo systemctl start postgresql#9.5-main
Error: You must run this program as the cluster owner (root) or root
I tried the same command with sudo:
Error: Config owner (postgres:124) and data owner (root:0) do not match, and config owner is not root
Which again makes me think the problem might lie with permissions of the directory. The directory is owned by root whose ownership I am unable to change.
EDIT-1
I've been working on this and I'd like to distill this post further to give more specifics. This is my current situation:
I installed postgres: sudo apt-get install postgresql and postgresql-contrib
I used sudo -U postgres psql to get into the postgres shell (I'm not sure if this is what I need to do)
show data_directory returns: /var/lib/postgresql/9.5/main
The data directory is located in Ubuntu ext4 formatted hard drive. I also have a 1 TB NTFS formatted hard disk mounted on /mnt/Data (which is mounted automatically on boot). What I tried:
Stop the postgres service: sudo systemctl stop postgresql
Create a new directory /mnt/Data/postgresdb and copy contents of the previous main to this which gives me a full path of /mnt/Data/postgresdb/postgresql/9.5/main using: sudo rsync -av /var/lib/postgresql/ /mnt/Data/postgresdb/postgresql/
Edit /etc/postgresql/9.5/main/postgresql.conf to change data_directory from the path mentioned above to /mnt/Data/postgresdb/postgresql/9.5/main
Start the postgres service: sudo systemctl start postgresl
Run sudo -U postgres psql but get the error that was mentioned in the original post.
These are the permissions on the respective main directories:
ls -l /var/lib/postgresql/9.5/
total 4.0K drwx------ 19 postgres postgres 4.0K Jan 16 12:40 main
ls -l /mnt/Data/postgresdb/postgresql/9.5/
total 4.0K drwxrwxrwx 1 root root 4.0K Jan 16 12:13 main
From the looks of it, the default directory is owned by "postgres" and the new directory is owned by root. However, when I try to change ownership to postgres: chown -R postgres main, it doesn't output any error, but the ownership doesn't change. I'm curious whether this is because this drive is NTFS formatted and is mounted.
Here is my /etc/fstab:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda5 during installation
UUID=3f5a9875-89a3-4ce5-b778-9d7aaf148ed6 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=85c3f4d4-e450-435b-8dd6-cf1b2cbd8fc2 none swap sw 0 0
/dev/disk/by-label/Data /mnt/Data auto nosuid,nodev,nofail,x-gvfs-show 0 0
Any ideas on how I can go about fixing this?
ORIGINAL POST
Recently, I installed Postgresql for storing some data for my research. The dataset came with instructions on how to setup the data on a Postgresql database (if interested, more info on that here and here). I installed Postgresql and set up a "role" and used the script that was provided for loading the database. It worked but I underestimated the size of the dataset and the script quit saying there was no more space.
I have two drives on my computer a 250G SSD drive with Windows and Ubuntu installed (125G each). And a 1TB HDD NTFS formatted where I store my data. So I thought moving the database to a folder on the other drive would be helpful. I purged all the data and the database to start afresh and followed the instructions here to move the database directory. However, after moving the directory, when I try to connect using psql I get the following error:
~ psql -U username -d postgres 14:48:33
psql: 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"?
How can I fix this? I am running 64-bit Ubuntu 16.04 with Postgresql-9.5. As mentioned earlier, I moved the DB directory a NTFS formatted filesystem (not sure if that cause any problems).
Thanks.
As mentioned in the comments the NTFS was the problem. I ended up resizing my bigger hard drive with 100GB formatted as ext4 and was able to launch postgres with the new data directory without any problems.
I'm trying to run a PostgreSQL 9.6.2 db for a new project.
When I type in
postgres -D /usr/local/var/postgres
I get the following error message:
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 49425) running in data directory "/usr/local/var/postgres"?
When I get a list of all the processes for the folder, it appears:
49425
/usr/local/var/postgres
1491484894
5432
/tmp
localhost
Then when I try
kill 49425
It still remains in the list
And when I enter
pd
The 49425 PID number isn't on the list.
What is going wrong here?
it says there's a file /usr/local/var/postgres/postmaster.pid, so it won't start.
Instead of starting postgres with postgres -D /usr/local/var/postgres better try pg_ctl -D /usr/local/var/postgres start
Here is what I get when I try to access psql from console. I am using homebrew to run postgres.
atul-new-mac:sites user$ psql
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.5432"?
I checked the version by this:
atul-new-mac:sites user$ which psql
/usr/local/bin/psql
Here is the detail from the log file:
atul-new-mac:sites user$ tail -f /usr/local/var/postgres/server.log
ERROR: could not access status of transaction 0
DETAIL: Could not open file "pg_clog/0000": Permission denied.
LOG: received smart shutdown request
LOG: autovacuum launcher shutting down
LOG: shutting down
PANIC: could not open control file "global/pg_control": Permission denied
LOG: checkpointer process (PID 381) was terminated by signal 6: Abort trap
LOG: terminating any other active server processes
LOG: could not open temporary statistics file "pg_stat/global.tmp": Permission denied
LOG: abnormal database system shutdown
This is what I get when I try to start it manually:
atul-new-mac:postgres user$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl: another server might be running; trying to start server anyway
server starting
sh: /usr/local/var/postgres/server.log: Permission denied
Your log tells that your postgresql instance is having trouble with permissions (lines ERROR and PANIC) and reading other extracts you give, you may already have a postgresql instance running.
To check it, just do this command:
ps aux | grep -i "*postgres*"
You should see all postgresql processes running.
Try to stop all thoses processes either by using pg_ctl stop or if nothing happens and the processes are still there, then try to kill them (I presume you're on a development platform, so that should not cause a problem for others)
kill -9 <postgresID>
Then when all the postgresql processes have disappeared, then try to start postgresql. If you're still having a permission problem, use lsof tool to see which process is locking your files.
I'm trying to test a small PostgreSQL setup, so I cobbled together a quick local install. However, when I'm trying to create my personal db with createdb, it chokes on errors like this (notably, it starts with base/16384 the first time, and increments each time I run it). Anyone know what's going on here, or if there's some trivial config I missed that would cause this? Thanks, and this is somewhat time-critical, so please respond if you do know anything. Thanks!
UPDATES:
I'm running this on a CentOS 5 server, apologies that I don't have too many further details (it's a shared account on that server). uname -a has the following output:
Linux {OMITTED} 2.6.18-194.11.4.el5 #1 SMP Tue Sep 21 05:04:09 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
I installed PostgreSQL from source from:
http://wwwmaster.postgresql.org/download/mirrors-ftp/source/v9.0.1/postgresql-9.0.1.tar.bz2
built in my home directory and installed to prefix=$HOME/local/pgsql.
Here's a terminal readout for me attempting to create my user's db on a fresh data setup:
[htung#{OMITTED}:~]$ killall postgres
LOG: autovacuum launcher shutting down
LOG: received smart shutdown request
LOG: shutting down
LOG: database system is shut down
[htung#{OMITTED}:~]$ rm -r tmp
mk[1]+ Done ../local/pgsql/bin/postgres -D $HOME/tmp (wd: ~/tmp)
(wd now: ~)
[htung#{OMITTED}:~]$ mkdir tmp
[htung#{OMITTED}:~]$ local/pgsql/bin/initdb -D $HOME/tmp
The files belonging to this database system will be owned by user "htung".
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".
fixing permissions on existing directory /afs/{OMITTED}/htung/tmp ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /afs/{OMITTED}/htung/tmp/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... 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 -A option the
next time you run initdb.
Success. You can now start the database server using:
local/pgsql/bin/postgres -D /afs/{OMITTED}/htung/tmp
or
local/pgsql/bin/pg_ctl -D /afs/{OMITTED}/htung/tmp -l logfile start
[htung#{OMITTED}:~]$ local/pgsql/bin/postgres -D $HOME/tmp
LOG: database system was shut down at 2010-11-15 13:47:25 PST
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
[1]+ Stopped local/pgsql/bin/postgres -D $HOME/tmp
[htung#{OMITTED}:~]$ bg
[1]+ local/pgsql/bin/postgres -D $HOME/tmp &
[htung#{OMITTED}:~]$ local/pgsql/bin/createdb
ERROR: could not fsync file "base/16384": Invalid argument
STATEMENT: CREATE DATABASE htung;
createdb: database creation failed: ERROR: could not fsync file "base/16384": Invalid argument
[htung#{OMITTED}:~]$
I would guess that you're possibly running into the SE linux system here. I'd recommend to either turn off SELinux and see if that works, or to install from RPMs available from the postgresql website.