Upgrade InfluxDB to version 0.9.6.1
InfluxDB uses the /var/lib/influxdb directory to store its data instead of /opt/influxdb previously. Implements: blueprint influxdb-clustering Change-Id: I090298bcbd37e5bd0be876d39525a995f08c2b78
This commit is contained in:
parent
4d83221412
commit
9b84bc5b1d
|
@ -1,218 +0,0 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: influxd
|
||||
# Required-Start: $all
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start influxd at boot time
|
||||
### END INIT INFO
|
||||
|
||||
# If you modify this, please make sure to also edit influxdb.service
|
||||
# this init script supports three different variations:
|
||||
# 1. New lsb that define start-stop-daemon
|
||||
# 2. Old lsb that don't have start-stop-daemon but define, log, pidofproc and killproc
|
||||
# 3. Centos installations without lsb-core installed
|
||||
#
|
||||
# In the third case we have to define our own functions which are very dumb
|
||||
# and expect the args to be positioned correctly.
|
||||
|
||||
# Command-line options that can be set in /etc/default/influxdb. These will override
|
||||
# any config file values. Example: "-join http://1.2.3.4:8086"
|
||||
DEFAULT=/etc/default/influxdb
|
||||
|
||||
# Daemon options
|
||||
INFLUXD_OPTS=
|
||||
|
||||
# Process name ( For display )
|
||||
NAME=influxdb
|
||||
|
||||
# User and group
|
||||
USER=influxdb
|
||||
GROUP=influxdb
|
||||
|
||||
# Daemon name, where is the actual executable
|
||||
# If the daemon is not there, then exit.
|
||||
DAEMON=/opt/influxdb/influxd
|
||||
[ -x $DAEMON ] || exit 5
|
||||
|
||||
# Configuration file
|
||||
CONFIG=/etc/opt/influxdb/influxdb.conf
|
||||
|
||||
# PID file for the daemon
|
||||
PIDFILE=/var/run/influxdb/influxd.pid
|
||||
PIDDIR=`dirname $PIDFILE`
|
||||
if [ ! -d "$PIDDIR" ]; then
|
||||
mkdir -p $PIDDIR
|
||||
chown $USER:$GROUP $PIDDIR
|
||||
fi
|
||||
|
||||
# Max open files
|
||||
OPEN_FILE_LIMIT=65536
|
||||
|
||||
if [ -r /lib/lsb/init-functions ]; then
|
||||
source /lib/lsb/init-functions
|
||||
fi
|
||||
|
||||
# Logging
|
||||
if [ -z "$STDOUT" ]; then
|
||||
STDOUT=/dev/null
|
||||
fi
|
||||
|
||||
if [ ! -f "$STDOUT" ]; then
|
||||
mkdir -p $(dirname $STDOUT)
|
||||
fi
|
||||
|
||||
if [ -z "$STDERR" ]; then
|
||||
STDERR=/var/log/influxdb/influxd.log
|
||||
fi
|
||||
|
||||
if [ ! -f "$STDERR" ]; then
|
||||
mkdir -p $(dirname $STDERR)
|
||||
fi
|
||||
|
||||
# Overwrite init script variables with /etc/default/influxdb values
|
||||
if [ -r $DEFAULT ]; then
|
||||
source $DEFAULT
|
||||
fi
|
||||
|
||||
function pidofproc() {
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Expected three arguments, e.g. $0 -p pidfile daemon-name"
|
||||
fi
|
||||
|
||||
PID=`pgrep -f $3`
|
||||
local PIDFILE=`cat $2`
|
||||
|
||||
if [ "x$PIDFILE" == "x" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "x$PID" != "x" -a "$PIDFILE" == "$PID" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
function killproc() {
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Expected three arguments, e.g. $0 -p pidfile signal"
|
||||
fi
|
||||
|
||||
PID=`cat $2`
|
||||
|
||||
/bin/kill -s $3 $PID
|
||||
while true; do
|
||||
pidof `basename $DAEMON` >/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
n=$(expr $n + 1)
|
||||
if [ $n -eq 30 ]; then
|
||||
/bin/kill -s SIGKILL $PID
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function log_failure_msg() {
|
||||
echo "$@" "[ FAILED ]"
|
||||
}
|
||||
|
||||
function log_success_msg() {
|
||||
echo "$@" "[ OK ]"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
# Check if config file exist
|
||||
if [ ! -r $CONFIG ]; then
|
||||
log_failure_msg "config file doesn't exists"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# Checked the PID file exists and check the actual status of process
|
||||
if [ -e $PIDFILE ]; then
|
||||
pidofproc -p $PIDFILE $DAEMON > /dev/null 2>&1 && STATUS="0" || STATUS="$?"
|
||||
# If the status is SUCCESS then don't need to start again.
|
||||
if [ "x$STATUS" = "x0" ]; then
|
||||
log_failure_msg "$NAME process is running"
|
||||
exit 0 # Exit
|
||||
fi
|
||||
# if PID file does not exist, check if writable
|
||||
else
|
||||
su -s /bin/sh -c "touch $PIDFILE" $USER > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
log_failure_msg "$PIDFILE not writable, check permissions"
|
||||
exit 5
|
||||
fi
|
||||
fi
|
||||
|
||||
# Bump the file limits, before launching the daemon. These will carry over to
|
||||
# launched processes.
|
||||
ulimit -n $OPEN_FILE_LIMIT
|
||||
if [ $? -ne 0 ]; then
|
||||
log_failure_msg "set open file limit to $OPEN_FILE_LIMIT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_success_msg "Starting the process" "$NAME"
|
||||
if which start-stop-daemon > /dev/null 2>&1; then
|
||||
start-stop-daemon --chuid $GROUP:$USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- -pidfile $PIDFILE -config $CONFIG $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &
|
||||
else
|
||||
su -s /bin/sh -c "nohup $DAEMON -pidfile $PIDFILE -config $CONFIG $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &" $USER
|
||||
fi
|
||||
log_success_msg "$NAME process was started"
|
||||
;;
|
||||
|
||||
stop)
|
||||
# Stop the daemon.
|
||||
if [ -e $PIDFILE ]; then
|
||||
pidofproc -p $PIDFILE $DAEMON > /dev/null 2>&1 && STATUS="0" || STATUS="$?"
|
||||
if [ "$STATUS" = 0 ]; then
|
||||
if killproc -p $PIDFILE SIGTERM && /bin/rm -rf $PIDFILE; then
|
||||
log_success_msg "$NAME process was stopped"
|
||||
else
|
||||
log_failure_msg "$NAME failed to stop service"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log_failure_msg "$NAME process is not running"
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
# Restart the daemon.
|
||||
$0 stop && sleep 2 && $0 start
|
||||
;;
|
||||
|
||||
status)
|
||||
# Check the status of the process.
|
||||
if [ -e $PIDFILE ]; then
|
||||
if pidofproc -p $PIDFILE $DAEMON > /dev/null; then
|
||||
log_success_msg "$NAME Process is running"
|
||||
exit 0
|
||||
else
|
||||
log_failure_msg "$NAME Process is not running"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log_failure_msg "$NAME Process is not running"
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
|
||||
version)
|
||||
$DAEMON version
|
||||
;;
|
||||
|
||||
*)
|
||||
# For invalid arguments, print the usage message.
|
||||
echo "Usage: $0 {start|stop|restart|status|version}"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
|
@ -19,6 +19,7 @@ class influxdb::configure (
|
|||
$config_file = undef,
|
||||
$data_dir = undef,
|
||||
$meta_dir = undef,
|
||||
$wal_dir = undef,
|
||||
$hh_dir = undef,
|
||||
) {
|
||||
|
||||
|
@ -40,6 +41,12 @@ class influxdb::configure (
|
|||
value => "\"${data_dir}\"",
|
||||
}
|
||||
|
||||
ini_setting { 'wal_dir':
|
||||
section => 'data',
|
||||
setting => 'wal-dir',
|
||||
value => "\"${wal_dir}\"",
|
||||
}
|
||||
|
||||
ini_setting { 'hh_dir':
|
||||
section => 'hinted-handoff',
|
||||
setting => 'dir',
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
# == Class: influxdb
|
||||
|
||||
class influxdb (
|
||||
$data_dir = $influxdb::params::data_dir,
|
||||
$hh_dir = $influxdb::params::hh_dir,
|
||||
$meta_dir = $influxdb::params::meta_dir,
|
||||
$data_dir = $influxdb::params::data_dir,
|
||||
$hh_dir = $influxdb::params::hh_dir,
|
||||
$meta_dir = $influxdb::params::meta_dir,
|
||||
$wal_dir = $influxdb::params::wal_dir,
|
||||
) inherits influxdb::params {
|
||||
|
||||
class {'influxdb::install': }
|
||||
|
@ -32,6 +33,7 @@ class influxdb (
|
|||
data_dir => $data_dir,
|
||||
hh_dir => $hh_dir,
|
||||
meta_dir => $meta_dir,
|
||||
wal_dir => $wal_dir,
|
||||
notify => Class['influxdb::service'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,20 +20,4 @@ class influxdb::install {
|
|||
ensure => installed,
|
||||
}
|
||||
|
||||
# The init script shipped by InfluxDB 0.9.4 fails because it tries to create
|
||||
# the PID file using 'su' without specifying /bin/sh while the influxdb user
|
||||
# has /sbin/nologin as the shell.
|
||||
file { '/etc/init.d/influxdb':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/influxdb/init.sh',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
require => Package['influxdb'],
|
||||
}
|
||||
|
||||
file { '/etc/logrotate.d/influxdb':
|
||||
ensure => present,
|
||||
source => 'puppet:///modules/influxdb/logrotate.conf',
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
class influxdb::params {
|
||||
$auth_enabled = true
|
||||
|
||||
$config_file = '/etc/opt/influxdb/influxdb.conf'
|
||||
$config_file = '/etc/influxdb/influxdb.conf'
|
||||
|
||||
$data_dir = '/opt/influxdb/data'
|
||||
$hh_dir = '/opt/influxdb/hh'
|
||||
$meta_dir = '/opt/influxdb/meta'
|
||||
$base_dir = '/var/lib/influxdb'
|
||||
$data_dir = "${base_dir}/data"
|
||||
$hh_dir = "${base_dir}/hh"
|
||||
$meta_dir = "${base_dir}/meta"
|
||||
$wal_dir = "${base_dir}/wal"
|
||||
}
|
||||
|
|
|
@ -19,6 +19,5 @@ class influxdb::service {
|
|||
ensure => running,
|
||||
enable => true,
|
||||
hasrestart => true,
|
||||
status => '/usr/bin/pgrep -u influxdb -f "/opt/influxdb/influxd "'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ class lma_monitoring_analytics::influxdb (
|
|||
data_dir => "${influxdb_dir}/data",
|
||||
meta_dir => "${influxdb_dir}/meta",
|
||||
hh_dir => "${influxdb_dir}/hh",
|
||||
wal_dir => "${influxdb_dir}/wal",
|
||||
}
|
||||
|
||||
file { $configure_influxdb:
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
# == Class lma_monitoring_analytics::params
|
||||
|
||||
class lma_monitoring_analytics::params {
|
||||
$listen_port = 8000
|
||||
$influxdb_url = 'http://localhost:8086'
|
||||
$influxdb_script = '/usr/local/bin/configure_influxdb.sh'
|
||||
$influxdb_dir = '/opt/influxdb'
|
||||
$influxdb_retention_period = 0
|
||||
$listen_port = 8000
|
||||
$influxdb_url = 'http://localhost:8086'
|
||||
$influxdb_script = '/usr/local/bin/configure_influxdb.sh'
|
||||
$influxdb_dir = '/var/lib/influxdb'
|
||||
$influxdb_retention_period = 0
|
||||
$influxdb_replication_factor = 1
|
||||
$grafana_domain = 'localhost'
|
||||
$grafana_domain = 'localhost'
|
||||
}
|
||||
|
|
|
@ -1674,7 +1674,7 @@
|
|||
"tags": [
|
||||
{
|
||||
"operator": "=",
|
||||
"value": "/opt/influxdb",
|
||||
"value": "/var/lib/influxdb",
|
||||
"key": "fs"
|
||||
}
|
||||
],
|
||||
|
@ -1691,14 +1691,14 @@
|
|||
}
|
||||
],
|
||||
"measurement": "fs_space_percent_free",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_percent_free\" WHERE \"fs\" = '/opt/influxdb' AND $timeFilter GROUP BY time($interval)",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_percent_free\" WHERE \"fs\" = '/var/lib/influxdb' AND $timeFilter GROUP BY time($interval)",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"maxDataPoints": 100,
|
||||
"span": 2,
|
||||
"colorBackground": false,
|
||||
"title": "Free space on /opt/influxdb",
|
||||
"title": "Free space on /var/lib/influxdb",
|
||||
"sparkline": {
|
||||
"full": false,
|
||||
"fillColor": "rgba(31, 118, 189, 0.18)",
|
||||
|
@ -1738,7 +1738,7 @@
|
|||
"id": 53,
|
||||
"fill": 1,
|
||||
"span": 10,
|
||||
"title": "Disk usage on /opt/influxdb",
|
||||
"title": "Disk usage on /var/lib/influxdb",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"value_type": "individual"
|
||||
|
@ -1758,7 +1758,7 @@
|
|||
"tags": [
|
||||
{
|
||||
"operator": "=",
|
||||
"value": "/opt/influxdb",
|
||||
"value": "/var/lib/influxdb",
|
||||
"key": "fs"
|
||||
}
|
||||
],
|
||||
|
@ -1771,7 +1771,7 @@
|
|||
"refId": "A",
|
||||
"alias": "free",
|
||||
"measurement": "fs_space_free",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_free\" WHERE \"fs\" = '/opt/influxdb' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_free\" WHERE \"fs\" = '/var/lib/influxdb' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"groupBy": [
|
||||
{
|
||||
"interval": "auto",
|
||||
|
@ -1785,7 +1785,7 @@
|
|||
"tags": [
|
||||
{
|
||||
"operator": "=",
|
||||
"value": "/opt/influxdb",
|
||||
"value": "/var/lib/influxdb",
|
||||
"key": "fs"
|
||||
}
|
||||
],
|
||||
|
@ -1798,7 +1798,7 @@
|
|||
"refId": "B",
|
||||
"alias": "used",
|
||||
"measurement": "fs_space_used",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_used\" WHERE \"fs\" = '/opt/influxdb' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_used\" WHERE \"fs\" = '/var/lib/influxdb' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"groupBy": [
|
||||
{
|
||||
"interval": "auto",
|
||||
|
@ -1812,7 +1812,7 @@
|
|||
"tags": [
|
||||
{
|
||||
"operator": "=",
|
||||
"value": "/opt/influxdb",
|
||||
"value": "/var/lib/influxdb",
|
||||
"key": "fs"
|
||||
}
|
||||
],
|
||||
|
@ -1825,7 +1825,7 @@
|
|||
"refId": "C",
|
||||
"alias": "reserved",
|
||||
"measurement": "fs_space_reserved",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_reserved\" WHERE \"fs\" = '/opt/influxdb' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"query": "SELECT mean(\"value\") AS \"value\" FROM \"fs_space_reserved\" WHERE \"fs\" = '/var/lib/influxdb' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"groupBy": [
|
||||
{
|
||||
"interval": "auto",
|
||||
|
@ -2946,4 +2946,4 @@
|
|||
"annotations": {
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ attributes:
|
|||
# Parameter hidden in the UI on purpose
|
||||
# this directory must match the mount point set in volumes.yaml
|
||||
data_dir:
|
||||
value: '/opt/influxdb'
|
||||
value: '/var/lib/influxdb'
|
||||
label: 'InfluxDB storage directory'
|
||||
description: 'Directory used by InfluxDB to store data'
|
||||
weight: 70
|
||||
|
|
|
@ -12,7 +12,7 @@ GRAFANA_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/bfraser-grafana-2.
|
|||
FUEL_LIB_COMMIT="7.0"
|
||||
FUEL_LIB_TARBALL_URL="https://github.com/openstack/fuel-library/archive/${FUEL_LIB_COMMIT}.tar.gz"
|
||||
|
||||
download_package https://s3.amazonaws.com/influxdb/influxdb_0.9.4.2_amd64.deb
|
||||
download_package https://s3.amazonaws.com/influxdb/influxdb_0.9.6.1_amd64.deb
|
||||
|
||||
download_package https://grafanarel.s3.amazonaws.com/builds/grafana_2.5.0_amd64.deb
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ volumes:
|
|||
generator_args: [30]
|
||||
label: "InfluxDB database"
|
||||
volumes:
|
||||
- mount: "/opt/influxdb"
|
||||
- mount: "/var/lib/influxdb"
|
||||
type: "lv"
|
||||
name: "influxdb"
|
||||
file_system: "ext4"
|
||||
|
|
Loading…
Reference in New Issue