Couchbase server as a Memcached cluster (part 1)

Preamble

One of our application new release is coming with Couchbase server as a component. They will use it as how Couchbase claim to be first implemented by customers: as a drop-in replacement of Memcached server.

In this typical Couchbase server installation Couchbase marketing claim you gain:

  • Elastic scalability
  • Always-on availability
  • Push-button manageability with graphical interface
  • Enterprise support in case you need it

They also argue that the replacement is transparent if you are coming from Memcached while it requires a bit of work if you are coming from Oracle Coherence. Those two caching products are the most well known.

As I have already tested Memcached is a previous post I wanted to see how transparent the replacement would be.

Testing has been done using two virtual machines running Oracle Enterprise Linux 7.2 64 bits. I allocated 2GB and 1 core to each virtual machine. They are called:

  • server2.domain.com using non routable IP 192.168.56.102
  • server3.domain.com using non routable IP 192.168.56.103

Couchbase server standalone installation

I have downloaded community edition for Red Hat 7 and the RPM download is for Centos 7:

[root@server2 ~]# yum -y install /tmp/couchbase-server-community-4.0.0-centos7.x86_64.rpm
Loaded plugins: ulninfo
Examining /tmp/couchbase-server-community-4.0.0-centos7.x86_64.rpm: couchbase-server-community-4.0.0-4051.x86_64
Marking /tmp/couchbase-server-community-4.0.0-centos7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package couchbase-server-community.x86_64 0:4.0.0-4051 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
===============================================================================================================================================================================================================
 Package                                              Arch                             Version                                Repository                                                                  Size
===============================================================================================================================================================================================================
Installing:
 couchbase-server-community                           x86_64                           4.0.0-4051                             /couchbase-server-community-4.0.0-centos7.x86_64                           200 M
 
Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package
 
Total size: 200 M
Installed size: 200 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: Swappiness is not set to 0.
Please look at http://bit.ly/1hTySfg as for how to PERMANENTLY alter this setting.
Minimum RAM required  : 4 GB
System RAM configured : 1.70 GB
 
Minimum number of processors required : 4 cores
Number of processors on the system    : 1 cores
 
  Installing : couchbase-server-community-4.0.0-4051.x86_64                                                                                                                                                1/1
Reloading systemd:  [  OK  ]
Starting couchbase-server (via systemctl):  Failed to start couchbase-server.service: Unit couchbase-server.service failed to load: No such file or directory.
[FAILED]
 
You have successfully installed Couchbase Server.
Please browse to http://server2.domain.com:8091/ to configure your server.
Please refer to http://couchbase.com for additional resources.
 
Please note that you have to update your firewall configuration to
allow connections to the following ports: 11211, 11210, 11209, 4369,
8091, 8092, 8093, 9100 to 9105, 9998, 18091, 18092, 11214, 11215 and
from 21100 to 21299.
 
By using this software you agree to the End User License Agreement.
See /opt/couchbase/LICENSE.txt.
 
  Verifying  : couchbase-server-community-4.0.0-4051.x86_64                                                                                                                                                1/1
 
Installed:
  couchbase-server-community.x86_64 0:4.0.0-4051
 
Complete!

Many warnings for memory and number of cores, as well as an error to start Couchbase server. As it is a test system I’m not paying much attention to memory/cores warnings. The only interesting parameter to change is memory swappiness that we have already seen. To make change persistent across reboot I have used:

[root@server2 ~]# cat /proc/sys/vm/swappiness
30
[root@server2 ~]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
 
#Set swappiness to 0 to avoid swapping
vm.swappiness = 0
[root@server2 ~]# sysctl -p
vm.swappiness = 0
[root@server2 ~]# cat /proc/sys/vm/swappiness
0

If you access to short link of installation log you will also see that Transparent Huge Pages (THP) should also be deactivated:

[root@server2 ~]# systemctl status ksm
● ksm.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
[root@server1 ~]# systemctl status ksmtuned
● ksmtuned.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

I have created a dedicated filesystem for Couchbase (RPM installation creates a couchbase user and group):

[root@server2 ~]# lvcreate -n lvol10 -L 4g vg00
  Logical volume "lvol10" created.
[root@server2 ~]# mkfs -t xfs /dev/vg00/lvol10
meta-data=/dev/vg00/lvol10       isize=256    agcount=4, agsize=262144 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=1048576, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@server2 ~]# chown couchbase:couchbase /couchbase

Starting Couchbase daemon with systemctl isn’t working:

[root@server2 ~]# systemctl start couchbase-server
Failed to start couchbase-server.service: Unit couchbase-server.service failed to load: No such file or directory.

As a workaround use start/stop script directly:

[root@server2 ~]# /opt/couchbase/etc/couchbase_init.d status
couchbase-server-community is not running
[root@server2 ~]# /opt/couchbase/etc/couchbase_init.d start
Starting couchbase-server-community

You can now access in your favorite browser to your server on port 8091:

couchbase01
couchbase01

Supply Couchbase directory to use, IP address of your server (if on localhost like me) and start a new cluster:

couchbase02
couchbase02

No sample buckets:

couchbase03
couchbase03

Bucket type as Memcached, all available memory allocated and flush option activated:

couchbase04
couchbase04

No notification:

couchbase05
couchbase05

Administrator account and password:

couchbase06
couchbase06

Then finally Couchbase server graphical interface:

couchbase07
couchbase07

Couchbase server cluster installation

The Linux part is exactly equivalent to the one of the first server. Only the graphical setup is slightly different.

Specify working directory, IP address of your server and choose join a cluster and supply administrator account and password:

couchbase08
couchbase08

You immediately reach the graphical interface that notify you a rebalance operation is needed, click on the link:

couchbase09
couchbase09

On this page click on Rebalance button (cannot be simpler):

couchbase10
couchbase10

And you are back on home page that is accessible on any node of the cluster (192.168.56.102 and 192.168.56.103):

couchbase11
couchbase11

References

About Post Author

Share the knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>