Skip to content. | Skip to navigation

Benutzerspezifische Werkzeuge

 
Sections
Artikelaktionen

IRF - Test Server Synchronisieren

Dokumentation bei Erstellung von IRF Test-Server

Test- Server Synchronisieren

Damit die Daten auf den Tests Server analog zu Produktiv Server bleibt, muss man die Daten synchronisieren. Man kann manuell oder die «Sync Scripts» verwenden.

------ IRF Synchronisation (Script) ------

 

1.1 - PROD Server - export

 

** Stop den Test Server  (Immer wenn möglich auch den PROD server)

cd /webserver/server-scripts/irf
# Repository - http://batfs.adm.ds.fhnw.ch:8080/tfs/FHNW/WEB-GIT/_git/serverscripts-wsnra134

sudo ./syncronize_export.sh irf.test.fhnw.ch
# Format: sudo sync_export.sh [dest-server]

# You will be asked for the Password of DB (check the config for the password dspace/config/dspace.cfg ).

Tasks:

  • Dump of DB (Postgres) into /var/dspace_backup/postgres
  • The folders "/var/dspace" and "/var/dspace_backup/postgres" will be sycronized"

2 - TEST Server - import

 

cd /webserver/server-scripts/irf

sudo ./syncronize_import.sh

# You will be asked for the Password of DB (check the config for the password dspace/config/dspace.cfg ).

Tasks:

  •  dspace stopp
  • DB will be deleted
  • Restore from dump:  (/var/dspace_backup/postgres)
  • Server started
  • Solr reindex

 

 

 ------ IRF Synchronisation (manuell) ------

1.1 - PROD Server - Manuellen export

** Wichtig: File System Level 'Dump'

Es ist nicht möglich den DB File direkt zu kopieren.

" There are two restrictions, however, which make this method impractical, or at least inferior to the pg_dump method"  - http://www.postgresql.org/docs/9.1/static/backup-file.html

1.1.1 - Database Dump

# generate Dump
pg_dump --username=[username] --password dspace > dump_irf_prod.sql

# Copy the file to the destination server
rsync -av dump_irf_prod.sql atmireFHNW@irf.test.fhnw.ch:/var/backups/


1.1.2  Bitstream (binary fiels) kopieren

# Copy the file to the destination server
rsync -av /home/dspace/dspace/assetstore atmireFHNW@irf.test.fhnw.ch:/home/dspace/dspace/

2 - TEST Server - Manuellen import

2.1 - Database restore

2.1.1 - Alte Database löschen

Die "dspace" Database umbenenen oder löschen und neu erstellen.

# stop dspace
sudo systemctl stop dspace
# login as postgres (ROOT)
sudo psql --host localhost -U postgres postgres

### If you want a local backup from DB:
# delete old backup if exists
drop database dspace_OLD;
# Rename the database
alter database dspace rename to dspace_OLD;

### or just delete it: DROP DATABASE dspace;

### Create a new DB
CREATE DATABASE dspace OWNER=dspace;
# or mit command-line: createdb -U dspace dspace
# To avoid problems mit rights (import)
ALTER ROLE dspace Superuser;
\q

2.1.2 - Daten von Dump Auslesen

sudo su -dspace
psql --set ON_ERROR_STOP=on --host localhost --username=dspace --password dspace < /var/dspace_backup/postgres/irf_dbdump.sql

2.2 - Solr neu indexieren

# delete (or use -b option) the old index 
# rm -rf /home/dspace/dspace/solr/search/data/


# Start dspace to reindex the data (Solr)
systemctl start dspace

# reindex the data
bin/dspace index-discovery -f