Installing Percona Server for MongoDB on Debian and Ubuntu

2016年12月14日

Percona provides .deb packages for 64-bit versions of the following distributions:

  • Debian 8 (“jessie”)
  • Ubuntu 14.04 LTS (Trusty Tahr)
  • Ubuntu 15.10 (Wily Werewolf)
  • Ubuntu 16.04 LTS (Xenial Xerus)

Note

Percona Server for MongoDB should work on other DEB-based distributions, but it is tested only on platforms listed above.

The packages are available in the official Percona software repositories and on the download page. It is recommended to intall Percona Server for MongoDB from repositories using apt.

Package Contents

percona-server-mongodb:
  Installs the mongo shell, import/export tools, other client utilities, server software, default configuration, and init.d scripts.
percona-server-mongodb-server:
  Contains the mongod server, default configuration files and init.d scripts.
percona-server-mongodb-shell:
  Contains the mongo shell.
percona-server-mongodb-mongos:
  Contains the mongos sharded cluster query router.
percona-server-mongodb-tools:
  Contains Mongo tools for high-performance MongoDB fork from Percona.
percona-server-mongodb-dbg:
  Contains debug symbols for the server.

Installing from Repositories

  1. Fetch the repository packages from Percona web:

    $ wget https://repo.percona.com/apt/percona-release_0.1-3.$(lsb_release -sc)_all.deb
    

  2. Install the downloaded package with dpkg. To do that, run the following command as root or with sudo:

    $ sudo dpkg -i percona-release_0.1-3.$(lsb_release -sc)_all.deb
    

    Once you install this package, the Percona repositories should be added. You can check the repository configuration in the /etc/apt/sources.list.d/percona-release.list file.

  3. Update the local cache:

    $ sudo apt-get update
    

  4. Install the server package:

    $ sudo apt-get install percona-server-mongodb
    

 

Testing and Experimental Repositories

Percona offers pre-release builds from the testing repo, and early-stage development builds from the experimental repo. To enable them, add either testing or experimental at the end of the Percona repository definition in your repository file (by default, /etc/apt/sources.list.d/percona-release.list).

For example, if you are running Debian 8 (“jessie”) and want to install the latest testing builds, the definitions should look like this:

deb http://repo.percona.com/apt jessie main testing
deb-src http://repo.percona.com/apt jessie main testing

If you are running Ubuntu 14.04 LTS (Trusty Tahr) and want to install the latest experimental builds, the definitions should look like this:

deb http://repo.percona.com/apt trusty main experimental
deb-src http://repo.percona.com/apt trusty main experimental

Pinning the Packages

If you want to pin your packages to avoid upgrades, create a new file /etc/apt/preferences.d/00percona.pref and add the following lines to it:

Package: *
Pin: release o=Percona Development Team
Pin-Priority: 1001

For more information about pinning, refer to the official Debian Wiki.

Using Percona Server for MongoDB

By default, Percona Server for MongoDB stores data files in /var/lib/mongodb/ and configuration parameters in /etc/mongod.conf.

  1. Starting the service

    Percona Server for MongoDB is started automatically after installation unless it encounters errors during the installation process. You can also manually start it using the folowing command:

    $ sudo service mongod start
    

  2. Confirming that service is running

    Check the service status using the following command:

    $ service mongod status
    

  3. Stopping the service

    Stop the service using the following command:

    $ sudo service mongod stop
    

  4. Restarting the service

    Restart the service using the following command:

    $ sudo service mongod restart
    

Note

Debian 8 (“jessie”) and Ubuntu 15.04 (Vivid Vervet) come with systemd as the default system and service manager. You can invoke all the above commands with sytemctl instead of service. Currently both are supported.

Note

By default, Percona Server for MongoDB starts with the MMAPv1 storage engine (standard engine in MongoDB). If you want to run with PerconaFT, specify the --storageEngine=PerconaFT option on the command line when running mongod, or set the storage.engine option in the configuration file. For more information, see Switching Storage Engines.

Uninstalling Percona Server for MongoDB

To uninstall Percona Server for MongoDB you’ll need to remove all the installed packages. Removing packages with apt-get remove will leave the configuration and data files. Removing the packages with apt-get purge will remove all the packages with configuration files and data files (all the databases). Depending on your needs you can choose which command better suits you.

  1. Stop the server:

    $ sudo service mongod stop
    

  2. Remove the packages.

    • If you want to leave configuration and data files:

      $ sudo apt-get remove percona-server-mongodb*
      

    • If you want to delete configuration and data files as well as the packages:

      $ sudo apt-get purge percona-server-mongodb*
      

没有评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注