12 Replies Latest reply: Jan 5, 2014 9:51 AM by FlorianLeo
Matthew Jason Level 1 Level 1 (0 points)

Hi.

 

I followed the instruction here:

 

http://support.apple.com/kb/HT5585

 

Under Copying all wikis from one OS X server to another OS X server, I am not even able to execute:

 

sudo pg_dump --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab

 

It gives this error:

 

pg_dump: [archiver (db)] connection to database "collab" failed: FATAL:  role "collab" does not exist

 

Any idea?

 

I just tested it on the productive server as well as a brand new install. Same outcome.

 

which then I moved the: /Library/Server/Wiki/FileData over but even stop/start, restart, wiki server is running but not able to load content, it's like it's been wiped clean.

 

matthew


MacBook Air (13-inch Late 2010), OS X Mountain Lion (10.8.2)
  • 1. Re: Move WIKI data from one Mountain Lion Server to another
    Rolf Kocherhans Level 1 Level 1 (5 points)

    I can confirm this, I have exactly the same problem !

     

    Unfortunatly I have no solution !!!!

  • 2. Re: Move WIKI data from one Mountain Lion Server to another
    Matthew Jason Level 1 Level 1 (0 points)

    I have another Mountain Lion Clean install set up sometime ago. And it has no issue dumping the database. Strange how this newly set up can't. Very frustrating. Hope to find solution soon.

     

    matthew

  • 3. Re: Move WIKI data from one Mountain Lion Server to another
    Rolf Kocherhans Level 1 Level 1 (5 points)

    Do you remeber the OSX and Server version ?

     

    Cheers

    Rolf

  • 4. Re: Move WIKI data from one Mountain Lion Server to another
    Matthew Jason Level 1 Level 1 (0 points)

    Hi Rolf.

     

    The working computer, I have older Server app. the last versoin before this 2.2. I think it is a 2.2 bug.

     

    I search around for days and this is what I have so far:

     

    Create role/user??:

     

    /usr/bin/createdb -U collab collab

     

    dump Postgres:

     

    /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab

     

    I use that instead of the Apple doc suggestion cause it will cause version number mismatch and will stall the dump.

     

    I got this far, please provide better suggestion.

  • 5. Re: Move WIKI data from one Mountain Lion Server to another
    Matthew Jason Level 1 Level 1 (0 points)

    And when I try to restore, I get this:

     

    sh-3.2# sudo -u _postgres pg_restore -d collab -U collab --single-transaction /tmp/collab.pgdump

    could not identify current directory: Permission denied

  • 6. Re: Move WIKI data from one Mountain Lion Server to another
    Rolf Kocherhans Level 1 Level 1 (5 points)

    Hello Jason

     

    I would LOVE to provide a better suggestion, but I can't. Like you, I am

    searching for days for a solution, tried many things including adding

    the path to .profile etc. !!!

     

    Nothing worked !

     

    A colleague suggested to try to use a Time Machine backup from an old server

    and on the new use the Migration Assistant to import the WIKI !

     

    This is NOT what I wanted to do, but right now I am trying this, just to see

    if it works !

     

    My goal would be to export a WIKI and then setup a new fresh clean OS X Server and

    import the old WIKI Data. This, to have a clean start !

     

    The old Server was updated/migrated from 10.6.8 and I don't trust it,

    also I need a worst case senario.

     

    If I find out something I will post it asap !

     

    Cheers

    Rolf

  • 7. Re: Move WIKI data from one Mountain Lion Server to another
    Doug Whitmore Level 2 Level 2 (235 points)

    For Server 2.2 you need to add another flag to pg_dump and pg_restore:

    -h "/Library/Server/PostgreSQL For Server Services/Socket"

     

    So, for dump on a 2.2 Server:

    sudo pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket" --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab

     

    And for restore:

    sudo -u _postgres pg_restore -h "/Library/Server/PostgreSQL For Server Services/Socket" -d collab -U collab --single-transaction /tmp/collab.pgdump

  • 8. Re: Move WIKI data from one Mountain Lion Server to another
    Matthew Jason Level 1 Level 1 (0 points)

    Thanks Doug.

     

    That seems to work. Even after deleting Server app and all the data in Library/Server.

    I still get the error, so still can't restore.

     

    Noticed also I can't use pg_dump outright as it will cause version number conflict.

     

    Screen Shot 2012-12-19 at 5.26.30 AM.png

  • 9. Re: Move WIKI data from one Mountain Lion Server to another
    Rolf Kocherhans Level 1 Level 1 (5 points)

    Hello Metthew

     

    I got some mor infos from an Apple System Engineer, with it, I could successfully export the WIKI .

     

    1. Frist install Workgroup Manager and add your Admin account to the postgress group !

    2. Paste this into Terminal:

     

    sudo /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump  -h /Library/Server/PostgreSQL\ For\ Server\ Services/Socket --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab

     

    You will notice that the script is similar to Dougs but it uses the pg_dump inside the Server app.

     

    This worked for me ----- finally

     

    I then copied the exorted /tmp/collab.pgdump to the new Server and I am now trying to import this

    with help of http://support.apple.com/kb/HT5585 but I strugle - give me some more time to try.

     

    Cheers

    Rolf

  • 10. Re: Move WIKI data from one Mountain Lion Server to another
    Rolf Kocherhans Level 1 Level 1 (5 points)

    Hello Metthew

     

    Apple has change the information (Terminal commands) on its KB Article

    http://support.apple.com/kb/HT5585 on december 21 !

     

    I have just tried the new commands, and can report that moving WIKI data from

    10.8.2 to a new 10.8.2 does now work !

     

    Cheers

    Rolf

  • 11. Re: Move WIKI data from one Mountain Lion Server to another
    Bolla_ Level 1 Level 1 (0 points)

    I have a solution to recover the Wiki after OSX 10.8 was restored from a TimeMachine Backup.

     

    1. get the Backup file in /Library/Server/PostgreSQL For Server Services/Backup/dumpall.psql.gz
    2. extract the file to /tmp/dumpall.psql or to an other directory
    3. Follow the instructions in http://support.apple.com/kb/HT5585 like this:
      • sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
      • sudo chmod -R +a "www allow search" /Library/Server/Wiki/FileData

      • sudo serveradmin stop wiki

      • sudo serveradmin start postgres_server

      • cd /Applications/Server.app/Contents/ServerRoot/usr/bin/

      • sudo ./dropdb -h "/Library/Server/PostgreSQL For Server Services/Socket" -U collab collab

      • sudo ./createdb -h "/Library/Server/PostgreSQL For Server Services/Socket" -U collab collab

    4. Then use "psql" instead of "pg_restore":
      • sudo psql -U _postgres -d collab  -h "/Library/Server/PostgreSQL For Server Services/socket" -f /tmp/dumpall.psql
    5. Start the Wiki Server
      • sudo serveradmin start wiki
    6. Done!

     

    Greets

     

    Bolla

  • 12. Re: Move WIKI data from one Mountain Lion Server to another
    FlorianLeo Level 1 Level 1 (0 points)

    try it and RATE correct answers

     

     

     

     

    Hello Matthew

     

     

    You're looking in the wrong spot

    First things first - make yourself default sudo with sudo -s then you can forget prefixing it all the time.

     

     

    • If you just use pg_dump then it'll take the command from the /var-Directory - that's the wrong version
    • You have to specify the path for the Socket where the PSQL-Database for the wiki really is located by using the -h-option - it's not the default

    that's why you get the error that role collab does not exist since you're connecting to a database in place where the role collab truy isn't part of it.

     

     

    So - if you'd like to export the wiki-DB us the following and adapt the filename to what you like it to be.

     

     

    bash-3.2# /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket/" -p 5432 -f /Volumes/USBSTICK/wikidatabase.pgdump -U collab collab

     

     

    • The first block specifies the "not default" pg_dump you'd like to use
    • The second block (-h "/Library/.....) tells pg_dump where to find the DB
    • The third block tells pg_dump to use port 5432
    • The fourth block (-f /Volumes/......) tells pg_dump to place its output into this file
    • The fifth block (-U collab) tells pg_dump to do this is role collab
    • The sixth block tells pg_dump from with DB to dump from

     

     

    In your case extend my provided command with your options --format=c --compress=9 --blobs like this:

    bash-3.2# /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dump -h "/Library/Server/PostgreSQL For Server Services/Socket/" -p 5432 -F c --compress=9 -b -f /Volumes/USBSTICK/wikidatabase.pgdump -U collab collab

     

     

     

     

     

    BTW- you can connect to the database, of course:

    bash-3.2# psql -h "/Library/Server/PostgreSQL For Server Services/Socket/" -p 5432 collab collab

     

     

     

    try it and RATE correct answers

     

     

    Here is my thread https://discussions.apple.com/thread/5751873