Adding mongodb support to xenial

Changes to add support for mongodb for xenial to trove/integration.
The schema is the same proposed by Doug Shelley in the initial
work, splitting trusty and xenial.

- bumped version to 3.2.11
- conversion of upstart files in systemd unit files for mongod and
mongos
- added oneshot systemd unit file for Transparent Huge Pages
- added script to check if numactl is used by the system and oneshot
systemd unit file that will generate an environment file for mongod
systemd service

Change-Id: Ie6492b24f6803b35d929b499cfb7716e28bebfaa
Depends-On: I8e1de6ef31f969ccee88c334a0d5ed03aabd1b51
This commit is contained in:
Riccardo Pittau
2016-11-28 17:24:35 +01:00
parent 0fb67d459b
commit 72c4ba04c8
16 changed files with 171 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
set -e
set -o xtrace
[ -n "${RELEASE}" ] || die "RELEASE must be set to either Precise or Quantal"
[ -n "${RELEASE}" ] || die "RELEASE must be set to either trusty or xenial"
apt-get --allow-unauthenticated -y install software-properties-common

View File

@@ -5,4 +5,4 @@ set -o xtrace
export DEBIAN_FRONTEND=noninteractive
apt-get --allow-unauthenticated -y install mongodb-org=3.2.6
apt-get -y install mongodb-org=3.2.11

View File

@@ -0,0 +1 @@
ubuntu-mongodb

View File

@@ -0,0 +1,23 @@
#!/bin/sh
set -e
set -o xtrace
export DEBIAN_FRONTEND=noninteractive
cat > /lib/systemd/system/disable_transparent_huge_pages.service << '_EOF_'
[Unit]
Description=Disable Transparent Huge Pages
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c "/usr/bin/echo "never" | tee /sys/kernel/mm/transparent_hugepage/enabled"
ExecStart=/usr/bin/sh -c "/usr/bin/echo "never" | tee /sys/kernel/mm/transparent_hugepage/defrag"
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
systemctl enable disable_transparent_huge_pages.service
systemctl start disable-transparent-huge-pages.service

View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -e
set -o xtrace
export DEBIAN_FRONTEND=noninteractive
apt-get -y install mongodb-org=3.2.11

View File

@@ -0,0 +1,9 @@
#!/bin/bash
# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Install trove guest python dependencies - see trovestack functions_qemu
set -e
set -o xtrace
pip2 install pymongo>=3.0.2,!=3.1

View File

@@ -0,0 +1,26 @@
#!/bin/sh
set -e
set -o xtrace
# Remove the default pid file
rm -f /var/run/mongodb.pid
cat > /etc/mongod.conf << '_EOF_'
storage.dbPath: /var/lib/mongodb
security.authorization: enabled
storage.engine: wiredTiger
storage.journal.enabled: true
systemLog.destination: file
systemLog.logAppend: true
systemLog.path: /var/log/mongodb/mongod.log
_EOF_
cat > /etc/mongos.conf << '_EOF_'
security.authorization: enabled
systemLog.destination: file
systemLog.logAppend: true
systemLog.path: /var/log/mongodb/mongos.log
_EOF_

View File

@@ -0,0 +1,24 @@
#!/bin/sh
set -e
set -o xtrace
export DEBIAN_FRONTEND=noninteractive
mkdir -p /usr/share/mongodb
cat > /usr/share/mongodb/check_numa.sh << '_EOF_'
#!/bin/sh
# Handle NUMA access to CPUs (SERVER-3574)
# This verifies the existence of numactl as well as testing that the command works
# Then it generates an environment file for systemd
NUMACTL_ARGS="--interleave=all"
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
then
echo -n NUMACTL="$(which numactl) $NUMACTL_ARGS" > /etc/numactl.env
else
echo -n NUMACTL="" > /etc/numactl.env
fi
_EOF_
chmod 755 /usr/share/mongodb/check_numa.sh

View File

@@ -0,0 +1,19 @@
#!/bin/sh
set -e
set -o xtrace
cat > /lib/systemd/system/check-numa.service << '_EOF_'
[Unit]
Description=Generates /etc/numactl.env
[Service]
Type=oneshot
ExecStart=/usr/share/mongodb/check-numa.sh
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
systemctl enable check-numa.service

View File

@@ -0,0 +1,30 @@
#!/bin/sh
set -e
set -o xtrace
cat > /lib/systemd/system/mongod.service << '_EOF_'
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual
[Service]
User=mongodb
Group=mongodb
RuntimeDirectory=mongodb
EnvironmentFile=/etc/numactl.env
ExecStart=$NUMACTL /usr/bin/mongod --quiet --config /etc/mongod.conf
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitRSS=infinity
LimitNPROC=64000
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
systemctl enable mongod.service

View File

@@ -0,0 +1,29 @@
#!/bin/sh
set -e
set -o xtrace
cat > /lib/systemd/system/mongos.service << '_EOF_'
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual
[Service]
User=mongodb
Group=mongodb
RuntimeDirectory=mongodb
ExecStart=/usr/bin/mongos --quiet --config /etc/mongos.conf
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitRSS=infinity
LimitNPROC=64000
[Install]
WantedBy=multi-user.target
_EOF_
systemctl daemon-reload
systemctl enable mongos.service