Couchbase Installation On Linux

In order for couchbase to work more efficiently, we need to make some settings on the operating system, before non-root database installation.

Firstly, we have to check THP status. With ‘cat’ command below, we can check the status.
cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag

[always] madvise never
As a result, it will show you “[always]”. We have to set it to “[never]”

For this, go to vi /etc/init.d/disable-thp
then paste the script which is below;

#Provides: disable-thp
#Required-Start: $local_fs
#X-Start-Before: couchbase-server
#Default-Start: 2 3 4 5
#Default-Stop: 0 1 6
#Short-Description: Disable THP
#Description: disables Transparent Huge Pages (THP) on boot

case $1 in
if [ -d /sys/kernel/mm/transparent_hugepage ]; then
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag
elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
echo 'never' > /sys/kernel/mm/redhat_transparent_hugepage/enabled
echo 'never' > /sys/kernel/mm/redhat_transparent_hugepage/defrag
return 0

Then give permisson to file with chmod
chmod 755 /etc/init.d/disable-thp

Execute the file
service disable-thp start

Check the status again;
cat /sys/kernel/mm/transparent_hugepage/enabled
It should like on ‘never’ like this
always madvise [never]

Make Swap Space Configuration
Check to number of swap space
cat /proc/sys/vm/swappiness

As default, it is 30, we need set it 0.
sudo sysctl vm.swappiness=0 run this command or go to /etc/sysctl.conf and add this vm.swappiness = 0 into the file.

Now, create a group and add into a user for install couchbase as a non-root

groupadd -g 909 nosql 

useradd -g nosql -m -s /bin/bash -d /home/couchbase -c "couchbase server" -u 909 couchbase 

Set password for user ‘couchbase’
passwd couchbase

For set the number of files for couchbase server go to vi /etc/security/limits.conf and add the text below before end of the file

couchbase     soft  nofile  51200
couchbase     hard  nofile  51200 

Create a path for install the server
mkdir -p /app/couchbase/inst1

Set permission to ‘couchbase’ which is in the ‘nosql’ group to access the path
chown -R couchbase:nosql /app/couchbase

Login with ‘couchbase’ user
su – couchbase

Set some parameters for couchbase user, go to vi .bash_profile then add the text below;

#Couchbase Server
CB_HOME=/app/couchbase/inst1/opt/couchbase ; 
export CB_HOME 
PATH=$CB_HOME/bin:$PATH:. ; 
export PATH 
Copy or move your RPM file to the /app/couchbase/inst1
cp couchbase-server-enterprise-6.0.2-centos7.x86_64.rpm /app/couchbase/inst1

Go to inside to path
cd /app/couchbase/inst1

run the command

rpm2cpio couchbase-server-enterprise-6.0.2-centos7.x86_64.rpm | cpio --extract --make-directories --no-absolute-filenames 

Couchbase server has been installed. Use ls command, there is opt and user file are created.

Go to opt/couchbase
cd opt/couchbase then run the command;

./bin/install/ `pwd` 

(On this step, couchbase server will change all default directories with our pwd. Our pwd is /app/couchbase/inst1/opt/couchbase)

Start server
./bin/couchbase-server \-- -noinput -detached
Stop server 
./bin/couchbase-server -k

Couchbase Server is ready for access, go to WEB UI with your localhost and port 8091.


Related Post

Leave a Reply

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