Non-Root Install and Upgrade

      +

      Couchbase Server can be installed on any supported Linux distribution by users who do not have root or sudo privileges. A non-root server, once installed, can be upgraded by the same users.

      Understanding Non-Root Install

      Whereas the standard package-based installation of Couchbase Server requires root or sudo privileges on all supported Linux distributions, an alternative, non-root installation can be also performed on all such distributions: this does not require root or sudo privileges.

      The procedures for non-root install, uninstall, stopping, and starting are:

      • Identical across all supported Linux distributions.

      • In each case, different from the equivalent procedure used for standard, package-based installation.

      All non-root procedures are described below.

      Prepare

      Before non-root install can be performed, the machine must be appropriately prepared. Note that preparations typically will require root or sudo privileges.

      Disable THP

      Transparent Huge Pages are enabled by default on most Linux systems; but are detrimental to the performance of Couchbase Server, and should therefore be disabled. To do this, follow the instructions provided in Disabling Huge Transparent Pages (THP).

      Configure Kernel Swappiness

      Optimal Couchbase-Server performance can be achieved by appropriately configuring kernel swappiness. To do this, follow the instructions provided in Swap Space and Kernel Swappiness.

      Establish Limits for User Processes and File Descriptors

      The maximum permitted number of concurrent user processes, and the maximum permitted number of currently open file descriptors, are both established on Linux systems with default values that are too low for running Couchbase Server with optimal performance and scale. The maximum number of user processes must therefore be reset to at least 10,000; and the maximum number of file descriptors to at least 200,000.

      Note that Linux establishes such limits per user; and that since Couchbase Server will not, following non-root install, run as a service, but as a user process, the limits must be established separately for each user or group designated to run the non-root Couchbase Server.

      Proceed as follows:

      1. Check the current setting for user processes, as it applies to the current administrator:

        ulimit -u

        The response indicates the maximum number of user processes currently permitted for the administrator, which this example assumes to be the default value, applied to all users.

        3829

        In this case, the number, 3829, is evidently lower than the Couchbase-Server requirement of 10000.

      2. Check the current setting for file descriptors as follows:

        ulimit -n

        The response indicates the maximum number of file descriptors currently permitted for the administrator, which this example assumes to be the default value, applied to all users.

        1024

        Again, in this case, the number, 1024, is lower than the Couchbase-Server requirement of 200000.

      3. Raise the current limits on user processes and file descriptors, for the user or group designated to perform non-root install and then run Couchbase Server. To do this, access /etc/security/limits.conf, and add hard and soft lines for the nproc and nofile types, specifying appropriate values. The domain value, in the left-most column, should be the user-name of the user, or the group-name of the group, designated to install and run Couchbase Server.

        Following these additions, the lines should appear as follows:

        nameofuserorgroup       soft    nproc           10000
        nameofuserorgroup       hard    nproc           10000
        
        nameofuserorgroup       soft    nofile          200000
        nameofuserorgroup       hard    nofile          200000

        Save the file and exit.

      4. Reboot the machine.

      5. Following reboot, the designated user or group-member can check all the limits that currently apply to them, as follows:

        ulimit -a

        This displays a list of limits for the designated user or group, among which appear the modified values for user processes and file descriptors:

        core file size          (blocks, -c) 0
        data seg size           (kbytes, -d) unlimited
        scheduling priority             (-e) 0
        file size               (blocks, -f) unlimited
        pending signals                 (-i) 3829
        max locked memory       (kbytes, -l) 64
        max memory size         (kbytes, -m) unlimited
        open files                      (-n) 200000
        pipe size            (512 bytes, -p) 8
        POSIX message queues     (bytes, -q) 819200
        real-time priority              (-r) 0
        stack size              (kbytes, -s) 8192
        cpu time               (seconds, -t) unlimited
        max user processes              (-u) 10000
        virtual memory          (kbytes, -v) unlimited
        file locks                      (-x) unlimited

      This concludes the procedure for establishing and verifying new limits for user processes and file descriptors.

      Install

      To perform a non-root installation of Couchbase Server on any supported Linux distribution, proceed as follows:

      1. Download the Couchbase Server RPM, using wget or curl.

      2. Using wget or curl, download the appropriate binary for your platform (the URI is the same for all supported x86_64 or aarch64 Linux distributions):

        In the following examples, use the appropriate suffix ("x86_64" or "aarch64") instead of <platform-suffix> for the cb-non-package-installer.
      3. Make the binary executable.

        chmod u+x ./cb-non-package-installer-<platform-suffix>
      4. Choose — and if necessary, create — an empty directory into which installation will occur. For example:

        mkdir ./cb-install
      5. Run the cb-non-package-installer-<platform-suffix> binary, to install Couchbase Server. For example:

         ./cb-non-package-installer-<platform-suffix> --install --install-location ./cb-install \
         --package ./couchbase-server-enterprise-7.1.0-amzn2.<platform-suffix>.rpm
        the program performs dependency checking, prior to installation. If installation cannot proceed, due to missing dependencies, the program displays corresponding notifications, and stops running.
      6. If dependencies have been flagged as missing, restore those dependencies by performing the necessary installations. Then, run the cb-non-package-installer-<platform-suffix> binary again.

      When installation is complete, the following notification is displayed:

      Successfully installed.

      Couchbase Server can now be started: see immediately below.

      Start, Stop, and Get Status

      To start, stop, or get status on a non-root Couchbase Server, use the couchbase-server command, provided in the opt/couchbase/bin directory that now resides under the specified install location. For example, the command’s directory might be accessed as follows:

      cd ./cb-install/opt/couchbase/bin

      Note that a reference page for this command is provided at couchbase-server.

      Start

      To start a non-root Couchbase Server, enter the following command:

      ./couchbase-server --start

      This starts a non-root Couchbase Server. No output is displayed.

      Get Status

      To get status on whether a non-root Couchbase Server is running, enter the following command.

      ./couchbase-server --status

      If a non-root Couchbase Server is running, the following is displayed:

      Couchbase Server is running

      If a non-root-installed Couchbase Server is not running, the following is displayed:

      Couchbase Server is not running

      Stop

      To stop a non-root Couchbase Server, enter the following command:

      ./couchbase-server --stop

      This stops a running, non-root Couchbase Server. The output might appear as follows:

      2020-06-30 09:33:03 cb_dist: terminating with reason: shutdown

      If no non-root Couchbase Server was running, no output is displayed.

      Uninstall

      To uninstall, stop the running non-root Couchbase Server, then remove the directory used as the install location, along with all its contents. For example:

      ./cb-install/opt/couchbase/bin/couchbase-server --stop
      rm -rf ./cb-install

      Upgrade

      To upgrade an existing non-root Couchbase Server,

      1. Ensure that the previous version of Couchbase Server is still installed, and has been configured (since the upgrade process will make use of the post-configuration install location and directory contents).

      2. Stop the server, if it is still running.

      3. Use the cb-non-package-installer binary again, this time specifying the --upgrade flag, instead of the --install flag. Specify the new package to be used for upgrade; and specify the install location of the currently resident Couchbase Server. For example:

        ./cb-non-package-installer-<platform-suffix> --upgrade --install-location ./cb-install \
        --package ./couchbase-server-enterprise-7.1.0-amzn2.<platform-suffix>.rpm

      During upgrade, the following message may appear:

      Running cbupgrade this could take some time

      When upgrade has completed, the following notification is displayed:

      Upgrade has completed successfully

      Note that important, additional information on upgrade is provided in Upgrading Couchbase Server.