Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2016
    Posts
    4

    Question Unanswered: run copy of database on another (backup) server

    Hi all,

    I tried to run copy of my database on another server.

    Found its path using
    Code:
    SHOW data_directory
    it is /var/lib/postgresql/9.3/main
    Put it into tar.gz archive using sudo on main server, copied archive into backup server, stopped postgresql on backup server, extracted archive into /var/lib/postgresql/9.3/main2 directory, changed data_directory path in /etc/postgresql/9.3/main/postgresql.conf, tried to start postgresql on backup server, but got error:

    Code:
    $ sudo service postgresql start
     * Starting PostgreSQL 9.3 database server                                                                                                                                   
    * Error: could not exec /usr/lib/postgresql/9.3/bin/pg_ctl /usr/lib/postgresql/9.3/bin/pg_ctl start -D /var/lib/postgresql/9.3/main2 -l /var/log/postgresql/postgresql-9.3-main.log -s -o  -c config_file="/etc/postgresql/9.3/main/postgresql.conf" : 
                                                                                                                                                                         [fail]
    Tried to put files into default directory and changed back path in conf file, then tried to start postgresql on backup server, got error again:

    $ sudo service postgresql start
    * Starting PostgreSQL 9.3 database server
    * Error: could not exec /usr/lib/postgresql/9.3/bin/pg_ctl /usr/lib/postgresql/9.3/bin/pg_ctl start -D /var/lib/postgresql/9.3/main -l /var/log/postgresql/postgresql-9.3-main.log -s -o -c config_file="/etc/postgresql/9.3/main/postgresql.conf" :
    [fail]
    How do I solve it?
    I suppose, I should change rights after extracting files from archive under sudo, but don't know what exactly to change.
    Please advise.
    Thanks ahead.

    Ubuntu 14.04.5 LTS (on both main and backup servers)
    Postgresql 9.3
    Last edited by mandylaz; 08-28-16 at 18:29.

  2. #2
    Join Date
    Aug 2016
    Posts
    4

    Smile

    Fixed using

    chown postgres:postgres /var/lib/postgresql/9.3/main -R
    chmod 0700 /var/lib/postgresql/9.3/main -R

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •