CouchDB: Unterschied zwischen den Versionen

Aus Hostsharing Wiki
Zur Navigation springen Zur Suche springen
K (Update Debian Bookworm / CouchDB 3.3.3)
(Update für SystemD)
Zeile 25: Zeile 25:
   admin = mein-couch-admin-password
   admin = mein-couch-admin-password


== Startskript ==
== Start mit SystemD ==


   xyz00-couchdb@h00:~$ cat couchdb/bin/couchdb.sh
   xyz00-couchdb@h00:~$ cat .config/systemd/user/couchdb.service


   #!/bin/bash
   [Unit]
   export ERL_EPMD_ADDRESS=127.0.0.1
  Description=CouchDB User Service
   export ERL_EPMD_PORT=34369
 
   export HOME=/home/pacs/xyz00/users/couchdb
  [Service]
   export COUCHDB_BASE=$HOME/couchdb
  WorkingDirectory=%h/couchdb
   exec $COUCHDB_BASE/bin/couchdb > $COUCHDB_BASE/var/log/couchdb.log 2>&1 &
  Environment="HOME=%h"
   echo $! > $COUCHDB_BASE/var/couchdb.pid
   Environment="ERL_EPMD_ADDRESS=127.0.0.1"
   Environment="ERL_EPMD_PORT=34369"
   Environment="COUCHDB_BASE=%h/couchdb"
   ExecStart=%h/couchdb/bin/couchdb
   StandardOutput=file:%h/couchdb/var/log/couchdb.log
   StandardError=inherit
  Restart=always
  PrivateTmp=true
  NoNewPrivileges=true
 
  [Install]
  WantedBy=default.target


== Monit ==


  xyz00-couchdb@h00:~$ cat .monitrc
Starten und Aktivieren des Service:
   set daemon 60 with start delay 120
 
   set logfile /home/pacs/xyz00/users/couchdb/monit/var/monit.log
   systemctl --no-pager --user daemon-reload
   set idfile /home/pacs/xyz00/users/couchdb/monit/var/monit.id
   systemctl --no-pager --user start couchdb.service
   set statefile /home/pacs/xyz00/users/couchdb/monit/var/monit.state
   systemctl --no-pager --user status couchdb.service
  set mailserver localhost
   systemctl --no-pager --user enable couchdb.service
  set mail-format { from: monit@xyz00.hostsharing.net }
 
  set alert xyz00@h93.hostsharing.net
  set httpd port 38008 address localhost
      allow couchdbadmin:<monit-passwort>
  check process couchdb with pidfile /home/pacs/xyz00/users/couchdb/couchdb/var/couchdb.pid
      start program "/home/pacs/xyz00/users/couchdb/couchdb/bin/couchdb.sh"
      stop program "/bin/bash -c '/bin/kill $( cat /home/pacs/xyz00/users/couchdb/couchdb/var/couchdb.pid )'"


== Dump und Restore ==
== Dump und Restore ==

Version vom 6. März 2024, 12:24 Uhr

CouchDB

Mit Debian Buster wird CouchDB nicht mehr als Debian Paket auf allen unseren Managed Servern installiert sein.

Ein paar Notizen zum Selbstbau:

 wget https://downloads.apache.org/couchdb/source/3.3.3/apache-couchdb-3.3.3.tar.gz
 tar xzf apache-couchdb-3.3.3.tar.gz 
 cd apache-couchdb-3.3.3
 ./configure --spidermonkey-version 78
 make release
 mv rel/couchdb ..
 cd ..
 rm -rf apache-couchdb-3.3.0*

Konfiguration

In der Datei ~/couchdb/etc/local.ini:

 [chttpd]
 port = 35994
 bind_address = 127.0.0.1
 ...
 [admins]
 admin = mein-couch-admin-password

Start mit SystemD

 xyz00-couchdb@h00:~$ cat .config/systemd/user/couchdb.service
 [Unit]
 Description=CouchDB User Service
 
 [Service]
 WorkingDirectory=%h/couchdb
 Environment="HOME=%h"
 Environment="ERL_EPMD_ADDRESS=127.0.0.1"
 Environment="ERL_EPMD_PORT=34369"
 Environment="COUCHDB_BASE=%h/couchdb"
 ExecStart=%h/couchdb/bin/couchdb
 StandardOutput=file:%h/couchdb/var/log/couchdb.log
 StandardError=inherit
 Restart=always
 PrivateTmp=true
 NoNewPrivileges=true
 
 [Install]
 WantedBy=default.target


Starten und Aktivieren des Service:

 systemctl --no-pager --user daemon-reload
 systemctl --no-pager --user start couchdb.service
 systemctl --no-pager --user status couchdb.service
 systemctl --no-pager --user enable couchdb.service


Dump und Restore

Mit dem folgenden Skript kann man einzelne Datenbanken aus einer CouchDB-Instanz sichern und wiederherstellen: