Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Move WIKI data from one Mountain Lion Server to another

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)

Posted on Dec 17, 2012 9:01 PM

Reply
13 replies

Dec 18, 2012 6:06 AM in response to Rolf Kocherhans

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.

Dec 18, 2012 6:54 AM in response to Matthew Jason

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

Dec 18, 2012 10:19 AM in response to Matthew Jason

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

Dec 19, 2012 6:48 AM in response to Matthew Jason

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

Sep 18, 2013 11:54 AM in response to Matthew Jason

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

Jan 5, 2014 9:51 AM in response to Matthew Jason

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

Aug 13, 2015 10:36 PM in response to Rolf Kocherhans

  • 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


This helped me export from 10.8.5 Server without the version missmatch. Thanks

Now on to the import.. to 10.10.

Fingers crossed.

Move WIKI data from one Mountain Lion Server to another

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.