将 postgresql 集群从 9.5 升级到 11 nominatim.so 不兼容
upgrading postgresql cluster from 9.5 to 11 nominatim.so incompatible
PostgreSQL 9.5
数据库提名
如果我尝试将 postgresql 升级到 11:
sudo pg_upgradecluster -m upgrade -k 9.5 main
结果:
more /var/log/postgresql/pg_upgradecluster-9.5-11-main.Dzbj/loadable_libraries.txt
无法加载库“/mnt/data/openstreetmap/nominatim/Nominatim-2.5.1/module/nominatim.so”:错误:biblioteca «/mnt/data/openstreetmap/nominatim/Nominatim-2.5.1/mo
dule/nominatim.so» 不兼容:版本不一致
DETALLE: 服务器是 11 版,库是 9.5 版。
我应该遵循哪些步骤来避免必须删除数据库并重新创建它?
postgresql 9.5 到 11
使用 postgis 2.2 到 2.5
sudo apt-get install curl ca-certificates
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-11
sudo service postgresql stop
sudo pg_dropcluster --stop 11 main
sudo apt-get install postgresql-11-postgis-2.5
sudo apt-get install postgresql-server-dev-11
sudo apt-get install postgresql-doc-11
sudo apt-get install postgresql-contrib
sudo apt-get install postgresql-9.5-postgis-2.5
sudo cp /usr/lib/postgresql/11/lib/postgis-2.5.so /usr/lib/postgresql/11/lib/postgis-2.2.so
sudo cp /usr/lib/postgresql/11/lib/rtpostgis-2.5.so /usr/lib/postgresql/11/lib/rtpostgis-2.2.so
sudo service postgresql start
sudo psql gis postgres -c 'ALTER EXTENSION postgis UPDATE TO "2.5.1";'
sudo psql nominatim postgres -c 'ALTER EXTENSION postgis UPDATE TO "2.5.1";'
sudo service postgresql stop
sudo service postgresql start
sudo -u postgres psql -d nominatim
psql (11.1 (Ubuntu 11.1-3.pgdg16.04+1), servidor 9.5.14)
Digite «help» para obtener ayuda.
nominatim=# SELECT postgis_full_version();
nominatim=# \q
sudo service postgresql stop
su - nominatim
cd /..../Nominatim-3.2.0/
mv build build.old
mkdir build
cd build/
cmake ..
make
sudo pg_upgradecluster -m upgrade 9.5 main
sudo su postgres -c "/usr/lib/postgresql/11/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.5 main --stop
...
PostgreSQL 9.5
数据库提名
如果我尝试将 postgresql 升级到 11:
sudo pg_upgradecluster -m upgrade -k 9.5 main
结果:
more /var/log/postgresql/pg_upgradecluster-9.5-11-main.Dzbj/loadable_libraries.txt
无法加载库“/mnt/data/openstreetmap/nominatim/Nominatim-2.5.1/module/nominatim.so”:错误:biblioteca «/mnt/data/openstreetmap/nominatim/Nominatim-2.5.1/mo dule/nominatim.so» 不兼容:版本不一致 DETALLE: 服务器是 11 版,库是 9.5 版。
我应该遵循哪些步骤来避免必须删除数据库并重新创建它?
postgresql 9.5 到 11
使用 postgis 2.2 到 2.5
sudo apt-get install curl ca-certificates
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-11
sudo service postgresql stop
sudo pg_dropcluster --stop 11 main
sudo apt-get install postgresql-11-postgis-2.5
sudo apt-get install postgresql-server-dev-11
sudo apt-get install postgresql-doc-11
sudo apt-get install postgresql-contrib
sudo apt-get install postgresql-9.5-postgis-2.5
sudo cp /usr/lib/postgresql/11/lib/postgis-2.5.so /usr/lib/postgresql/11/lib/postgis-2.2.so
sudo cp /usr/lib/postgresql/11/lib/rtpostgis-2.5.so /usr/lib/postgresql/11/lib/rtpostgis-2.2.so
sudo service postgresql start
sudo psql gis postgres -c 'ALTER EXTENSION postgis UPDATE TO "2.5.1";'
sudo psql nominatim postgres -c 'ALTER EXTENSION postgis UPDATE TO "2.5.1";'
sudo service postgresql stop
sudo service postgresql start
sudo -u postgres psql -d nominatim
psql (11.1 (Ubuntu 11.1-3.pgdg16.04+1), servidor 9.5.14)
Digite «help» para obtener ayuda.
nominatim=# SELECT postgis_full_version();
nominatim=# \q
sudo service postgresql stop
su - nominatim
cd /..../Nominatim-3.2.0/
mv build build.old
mkdir build
cd build/
cmake ..
make
sudo pg_upgradecluster -m upgrade 9.5 main
sudo su postgres -c "/usr/lib/postgresql/11/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.5 main --stop
...