Skip to content

Instantly share code, notes, and snippets.

@sebastianrothbucher
Last active August 29, 2015 14:17
Show Gist options
  • Save sebastianrothbucher/f5462acecfbc635723d3 to your computer and use it in GitHub Desktop.
Save sebastianrothbucher/f5462acecfbc635723d3 to your computer and use it in GitHub Desktop.

A few tipps for migrating from Couch 1.6 (CentOS) to Couch 2.0 (CentOS)

as ever: your own risk ;-)

From plain source (incl. Fauxton et al)

  • make sure to have node and npm available (otherwise yum install nodejs)
  • Erlang installation is cruel (wx...; rpm -i --nodeps is your best friend)
  • erlang-solutions-1.0-1.noarch adds the repo of pre-compiled Erlang binaries
  • rebar (directly or via erlang-solutions) and reltool (also erlang-solutions):
  • the usual drill of ./configure && make && make install (./configure -c for test suite)
  • when you have a very new sphinx, the template names changed (and you have to do the same in the sources: src/docs/templates/couchdb/theme.conf)
  • TeX is a pain - I ended up installing supposably all of it and it still does not work - you can leave it out in the sources: src/docs/Makefile
  • local test suite in Fauxon (local and cluster port) - OK for me
  • make check (or parts of it; timeout issue for "FAIL restart" - fix by longer timeout line 62 of test/javascript/test_setup.js)
  • ditto for eunit: 200 times instead of 1000 times makes it succeed
  • connection close in the attachments.js test: a Heisenbug happening sometimes

From tarball (you can skip the above - yeah!) (includes Fauxton, etc. - npm, grunt et al not needed)

  • there is no way to circumvent erlang
  • just the drill of ./configure && make && sudo make install

Now it's /opt/couchdb/... and not /usr/local... (Installing into an occupied dir does not seem to overwrite databases, but why try?)

Updating data (replication is your best friend)

  • as we now have different data dirs (/opt/couchdb/var/lib instead of /usr/local/var/lib/couchdb) we have good separation
  • all DBs directly under /opt/couchdb/var/lib are in the "local" data dir and reachable via local port (normally 5986 - as opposed to the cluster port 5984)
  • copy to local data dir (1.6 to 2.0 works - the other way round does NOT)
  • symlink does also work BUT: you can never ever again open in 1.6 !!! In order to get a clustered db for local db with name dbname:
  • create a DB on the cluster port (curl -X PUT http://localhost:5984/dbname)
  • replicate from local to cluster and you are clustered - i.e. curl -X POST http://localhost:5984/replicate -H 'Content-type: application/json' -d '{"source": "http://localhost:5986/dbname", "target": "dbname"}'
  • you now have a clustered DB (and lots of files below /opt/couchdb/var/lib/shards...)
  • same can work after joining into a cluster (except that you need another DB name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment