Change MongoDB to version 3.2
Cleanup and update the mongodb elements to install MongoDB 3.2 Partial-Bug: 1582712 Change-Id: I7575746ac445a875349640ffa91d6d3fb6680cea
This commit is contained in:
parent
5b3b1efe25
commit
cd435a1254
|
@ -1,65 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# CONTEXT: GUEST during CONSTRUCTION as ROOT
|
||||
# PURPOSE: Install controller base required packages
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
cat > "/etc/rc.local" << _EOF_
|
||||
# Make sure to disable Linux kernel feature transparent huge pages,
|
||||
# it will affect greatly both memory usage and latency in a negative way.
|
||||
# See: http://docs.mongodb.org/manual/tutorial/transparent-huge-pages/
|
||||
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
|
||||
echo never > /sys/kernel/mm/transparent_hugepage/defrag
|
||||
fi
|
||||
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
|
||||
echo never > /sys/kernel/mm/transparent_hugepage/enabled
|
||||
fi
|
||||
|
||||
exit \$?
|
||||
|
||||
_EOF_
|
||||
|
||||
# see http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
|
||||
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" \
|
||||
| tee /etc/apt/sources.list.d/mongodb-org-3.0.list
|
||||
apt-get update
|
||||
apt-get install -y mongodb-org
|
||||
|
||||
# MongoDB configuration settings
|
||||
# use the default bindIP
|
||||
sed -i '/bindIp/d' /etc/mongod.conf
|
||||
# need to use smallFiles until the device is mounted
|
||||
sed -i 's/# mmapv1:/ mmapv1:\n smallFiles: true/' /etc/mongod.conf
|
||||
|
||||
cat > "/etc/init/mongos.conf" << '_EOF_'
|
||||
limit fsize unlimited unlimited # (file size)
|
||||
limit cpu unlimited unlimited # (cpu time)
|
||||
limit as unlimited unlimited # (virtual memory size)
|
||||
limit nofile 64000 64000 # (open files)
|
||||
limit nproc 64000 64000 # (processes/threads)
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/mongodb/
|
||||
end script
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [06]
|
||||
|
||||
script
|
||||
ENABLE_MONGOS="yes"
|
||||
if [ -f /etc/default/mongos ]
|
||||
then
|
||||
. /etc/default/mongos
|
||||
fi
|
||||
if [ "x$ENABLE_MONGOS" = "xyes" ]
|
||||
then
|
||||
exec start-stop-daemon --start --quiet --chuid mongodb \
|
||||
--exec /usr/bin/mongos -- --config /etc/mongod.conf
|
||||
fi
|
||||
end script
|
||||
_EOF_
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
cat > /etc/init.d/disable-transparent-hugepages << '_EOF_'
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: disable-transparent-hugepages
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop:
|
||||
# X-Start-Before: mongod mongodb-mms-automation-agent
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Disable Linux transparent huge pages
|
||||
# Description: Disable Linux transparent huge pages, to improve
|
||||
# database performance.
|
||||
### END INIT INFO
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
if [ -d /sys/kernel/mm/transparent_hugepage ]; then
|
||||
thp_path=/sys/kernel/mm/transparent_hugepage
|
||||
elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
|
||||
thp_path=/sys/kernel/mm/redhat_transparent_hugepage
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo 'never' > ${thp_path}/enabled
|
||||
echo 'never' > ${thp_path}/defrag
|
||||
|
||||
unset thp_path
|
||||
;;
|
||||
esac
|
||||
_EOF_
|
||||
|
||||
chmod 755 /etc/init.d/disable-transparent-hugepages
|
||||
|
||||
update-rc.d disable-transparent-hugepages defaults
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
apt-get -y install mongodb-org=3.2.6
|
|
@ -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_
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
cat > /etc/init/mongod.conf << '_EOF_'
|
||||
limit fsize unlimited unlimited
|
||||
limit cpu unlimited unlimited
|
||||
limit as unlimited unlimited
|
||||
limit nofile 64000 64000
|
||||
limit rss unlimited unlimited
|
||||
limit nproc 64000 64000
|
||||
|
||||
kill timeout 300 # wait 300s between SIGTERM and SIGKILL.
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/run/mongodb/
|
||||
touch /var/run/mongodb/mongod.pid
|
||||
chown mongodb -R /var/run/mongodb/
|
||||
end script
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [06]
|
||||
|
||||
script
|
||||
CONF=/etc/mongod.conf
|
||||
|
||||
# Handle NUMA access to CPUs (SERVER-3574)
|
||||
# This verifies the existence of numactl as well as testing that the command works
|
||||
NUMACTL_ARGS="--interleave=all"
|
||||
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
|
||||
then
|
||||
NUMACTL="$(which numactl) -- $NUMACTL_ARGS"
|
||||
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
|
||||
else
|
||||
NUMACTL=""
|
||||
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}
|
||||
fi
|
||||
|
||||
exec start-stop-daemon --start \
|
||||
--chuid mongodb \
|
||||
--pidfile /var/run/mongod.pid \
|
||||
--make-pidfile \
|
||||
--exec $NUMACTL /usr/bin/mongod $DAEMON_OPTS
|
||||
end script
|
||||
_EOF_
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
cat > /etc/init/mongos.conf << '_EOF_'
|
||||
limit fsize unlimited unlimited
|
||||
limit cpu unlimited unlimited
|
||||
limit as unlimited unlimited
|
||||
limit nofile 64000 64000
|
||||
limit rss unlimited unlimited
|
||||
limit nproc 64000 64000
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/run/mongodb/
|
||||
touch /var/run/mongodb/mongos.pid
|
||||
chown mongodb -R /var/run/mongodb/
|
||||
end script
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [06]
|
||||
|
||||
script
|
||||
exec start-stop-daemon --start \
|
||||
--chuid mongodb \
|
||||
--pidfile /var/run/mongos.pid \
|
||||
--make-pidfile \
|
||||
--exec /usr/bin/mongos -- --config /etc/mongos.conf
|
||||
end script
|
||||
_EOF_
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o xtrace
|
||||
|
||||
[ -n "${RELEASE}" ] || die "RELEASE must be set to either Precise or Quantal"
|
||||
|
||||
apt-get -y install software-properties-common
|
||||
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
|
||||
|
||||
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
|
||||
|
||||
apt-get -y update
|
|
@ -561,7 +561,7 @@ function cmd_set_datastore() {
|
|||
VERSION="10.1"
|
||||
elif [ "$DATASTORE_TYPE" == "mongodb" ]; then
|
||||
PACKAGES=${PACKAGES:-"mongodb-org"}
|
||||
VERSION="3.0"
|
||||
VERSION="3.2"
|
||||
elif [ "$DATASTORE_TYPE" == "redis" ]; then
|
||||
PACKAGES=${PACKAGES:-"redis-server"}
|
||||
VERSION="3.0"
|
||||
|
|
Loading…
Reference in New Issue