Comments (12)
I have also tried to migrate from sagemathinc/cocalc
to sagemathinc/cocalc-v2
and the suggested method was not very clear to me...
So, what I did at the old server:
docker exec -it old-cocalc-container bash
kill -9 `head -1 /projects/postgres/data/postmaster.pid` # check with ps axf...
PG10=/projects/postgres10
PG14=/projects/postgres
cp -a /projects/postgres $PG10
rm -rf /projects/postgres/data/* # does not need chown / chmod :-)
apt-get update && apt-get install postgresql-14
PG10_BIN=/usr/lib/postgresql/10/bin
PG14_BIN=/usr/lib/postgresql/14/bin
sudo -u sage $PG14_BIN/pg_ctl init -D $PG14/data
sudo -u sage $PG14_BIN/pg_upgrade -d $PG10/data -D $PG14/data -b $PG10_BIN -B $PG14_BIN
cp -a $PG10/data/{socket,pg_hba.conf} $PG14/data/
tail -3 $PG10/data/postgresql.conf >> $PG14/data/postgresql.conf
exit
docker stop old-cocalc-container
Run the new container using cocalc-v2
image.
Ta-da...
from cocalc-docker.
The following worked for me:
docker exec -it cocalc-server bash
PG10=/projects/postgres10
PG14=/projects/postgres
PG10_BIN=/usr/lib/postgresql/10/bin
PG14_BIN=/usr/lib/postgresql/14/bin
sudo -u sage $PG10_BIN/pg_ctl stop -D $PG14/data
cp -a /projects/postgres $PG10
rm -rf /projects/postgres/data/* # does not need chown / chmod :-)
apt-get update && apt-get install postgresql-14
cd /tmp
sudo -u sage $PG14_BIN/pg_ctl init -D $PG14/data
sudo -u sage $PG14_BIN/pg_upgrade -d $PG10/data -D $PG14/data -b $PG10_BIN -B $PG14_BIN
cp -a $PG10/data/{socket,pg_hba.conf} $PG14/data/
tail -3 $PG10/data/postgresql.conf >> $PG14/data/postgresql.conf
exit
docker stop old-cocalc-container
I was getting errors about "The source was not shut down cleanly" and/or "could not open log file "pg_upgrade_internal.log": Permission denied" when using kill -9
. Using pg_ctl stop
seems to fix those issues. I also needed to change to /tmp
instead of running the conversion command from /
.
from cocalc-docker.
Thank you @szazs89 … this looks like a first step towards automating this. I've added a link to your instructions from the README.md file.
from cocalc-docker.
When running
sudo -u sage $PG14_BIN/pg_upgrade -d $PG10/data -D $PG14/data -b $PG10_BIN -B $PG14_BIN
could not open log file "pg_upgrade_internal.log": Permission denied
Failure, exiting
Suggestions?
from cocalc-docker.
from cocalc-docker.
@crockeea check the ownership of the directory structure (the new one and the one which the db to be migrated from...)
from cocalc-docker.
@williamstein That command is copied from szazs89
's suggestion.
from cocalc-docker.
Please check the ownership of the relevant directories to see. Maybe use the user "postgres" or whatever the owner of the relevant files is.
from cocalc-docker.
> ls -l /projects
...
drwx------ 3 sage sage 18 Aug 26 2019 postgres
drwx------ 3 sage sage 18 Aug 26 2019 postgres10
I tried changing the owner of both directories to postgres
and running the command with sudo -u postgres
, but got the same error. I think the real problem was that I was running the command from /
; I got farther after cd /tmp
.
Now I'm getting
root@0bb1704ab603:/tmp# sudo -u sage $PG14_BIN/pg_upgrade -d $PG10/data -D $PG14/data -b $PG10_BIN -B $PG14_BIN
There seems to be a postmaster servicing the old cluster.
Please shutdown that postmaster and try again.
Failure, exiting
root@0bb1704ab603:/tmp# ps afx
PID TTY STAT TIME COMMAND
94 pts/0 Ss 0:00 bash
3796 pts/0 R+ 0:00 \_ ps afx
1 ? Ss 0:00 python3 /root/run.py
20 ? Ss 0:00 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups
29 ? S 0:00 /bin/bash -c mkdir -p /var/log/hub && cd /cocalc/src/packages/hub && npm run hub-docker-prod > /v
32 ? Sl 0:00 \_ npm run hub-docker-prod
60 ? Sl 0:00 \_ npm exec cocalc-hub-server --mode=multi-user --all --hostname=0.0.0.0 --https-key=/projec
71 ? Sl 0:14 \_ node /cocalc/src/packages/hub/node_modules/.bin/cocalc-hub-server --mode=multi-user -
from cocalc-docker.
"There seems to be a postmaster servicing the old cluster. Please shutdown that postmaster and try again."
I think this message is based on a pid file existing, not some actual process running. You have to find that file and delete it. It's called postmaster.pid. https://dba.stackexchange.com/questions/30949/cannot-shutdown-old-postmaster-when-upgrading-to-postgres-9-2
from cocalc-docker.
Thanks!!
from cocalc-docker.
One further note: if, in the process of doing this upgrade, you're moving /projects
to another location/drive, use cp -p
to preserve permissions. Otherwise, when you start the new server, your projects and files will appear but you will get an Error: EACCES, permission denied
error when you try to open a file.
from cocalc-docker.
Related Issues (20)
- support using a free local large language model instead of ChatGPT HOT 5
- GPU support issues HOT 2
- websocket closed every minute HOT 5
- cannot start sagemath kernel
- Installing wxMaxima for X11 HOT 1
- Installing RStudio for X11 HOT 1
- make REMEMBER_ME cookie depend on hostname
- Disable VS Code Server HOT 1
- Project invite token HOT 1
- sagemath seg fault
- Error replacing moved Files
- ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL on almost any interaction HOT 23
- Cleaning old and missing published shared files HOT 6
- set kernel priorities
- error while loading shared libraries HOT 5
- cocalc-docker asking for payment when trying to use gpt4, cannot turn off HOT 3
- Change/adjust/disable Token limit per user or globally not possible? HOT 2
- Update external PostgreSQL Guide
- rmarkdown doesn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocalc-docker.