基于ZFS存储的dalmatinerDB+DalmatinerFE+Grafana环境


  1. 部署zfs文件系统挂载到 /data
  2. 下载ddb git源:https://github.com/dalmatinerdb/dalmatinerdb/tree/0.3.1p1
  3. 下载dfe git源:https://github.com/dalmatinerdb/dalmatiner-frontend/tree/0.3.1p1
  4. 下载grafana rpm包:https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.3.2-1.x86_64.rpm
  5. 安装Grafana及dalmatinerdb数据源插件
yum install ./grafana-4.3.2-1.x86_64.rpm
grafana-cli plugins install dalmatinerdb-datasource
service grafana-server restart
  1. 安装dalmatinerDB+DalmatinerFE
yum install http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_19.3.6-1~centos~7_amd64.rpm
yum install gcc gcc-c++ libstdc++-devel git zlib-devel
unzip dalmatinerdb-0.3.1p1.zip
cd dalmatinerdb-0.3.1p1/
make rel
unzip dalmatiner-frontend-0.3.1p1.zip
cd dalmatiner-frontend-0.3.1p1/
make rel
  1. 配置
#dalmatinerDB
mv ~/dalmatinerdb-0.3.1p1/_build/prod/rel/ddb/* /data/ddb/
mkdir -p /data/dalmatinerdb/etc
mkdir -p /data/dalmatinerdb/db
mkdir -p /data/dalmatinerdb/log
cp /data/ddb/etc/dalmatinerdb.conf.example /data/dalmatinerdb/etc/dalmatinerdb.conf
sed -i -e '/RUNNER_USER=dalmatiner/d' /data/ddb/bin/ddb
sed -i -e '/RUNNER_USER=dalmatiner/d' /data/ddb/bin/ddb-admin

#DalmatinerFE
mv ~/dalmatiner-frontend-0.3.1p1/_build/prod/rel/dalmatinerfe/* /data/dfe/
mkdir -p /data/dalmatinerfe/etc
mkdir -p /data/dalmatinerfe/db
mkdir -p /data/dalmatinerfe/log
cp /data/dfe/etc/dalmatinerfe.conf.example /data/dalmatinerfe/etc/dalmatinerfe.conf
sed -i -e '/RUNNER_USER=dalmatiner/d' /data/dfe/bin/dalmatinerfe

  1. 启动
vi ddb.sh

#!/bin/bash
set -e

cat >&2 <<-'EOWARN'
        ****************************************************
                   The following ports / services
                     * 5555 / dalmatiner DB
        ****************************************************
EOWARN

CONF=/data/dalmatinerdb/etc/dalmatinerdb.conf

export HOST=$(ping -c1 $HOSTNAME | awk '/^PING/ {print $3}' | sed 's/[():]//g')||'127.0.0.1'
export CLUSTER_NAME=${CLUSTER_NAME:-ddb}
export COORDINATOR_NODE=${COORDINATOR_NODE:-$HOSTNAME}
export COORDINATOR_NODE_HOST=$(ping -c1 $COORDINATOR_NODE | awk '/^PING/ {print $3}' | sed 's/[():]//g')||'127.0.0.1'
export RING_SIZE=${RING_SIZE:-64}
## Update config
sed -i \\
    -e "s/^nodename = .*/nodename = ${CLUSTER_NAME}@${HOST}/" \\
    -e "s/^handoff.ip = .*/handoff.ip = ${HOST}/" \\
    $CONF
###lifetime = 604800
#echo "ring_size = ${RING_SIZE}" >> $CONF
admin=/data/ddb/bin/ddb-admin
ddb=/data/ddb/bin/ddb
$ddb start
$admin wait-for-service metric
$admin wait-for-service event
if [ ! "${COORDINATOR_NODE_HOST}" = "${HOST}" ]
then
    $admin cluster join ${CLUSTER_NAME}@${COORDINATOR_NODE_HOST}
    sleep $(( ( RANDOM % 10 )  + 5 ))
    $admin cluster plan
    $admin cluster commit
else
    IFS=';' read -r -a buckets <<< "${BUCKETS}"
    for bucket in "${buckets[@]}"
    do
        $admin buckets create ${bucket}
    done
fi
$admin buckets list
vi dfe.sh

#!/bin/bash
set -e

set -x

CONF=/data/dalmatinerfe/etc/dalmatinerfe.conf


#sed -i \\
#    -e "s/^ddb_connection.backend_host = .*/ddb_connection.backend_host = ${DB_NODE}/" \\
#    -e "s/^idx.pg.backend_host = .*/idx.pg.backend_host = ${PG_NODE}/" \\
#    $CONF
###ddb_connection.backend_host = 10.200.77.41
###nodename = dalmatinerfe@10.200.77.41
echo "none() -> drop." >/data/dalmatinerfe/etc/rules.ot
LOG=/data/dalmatinerfe/log/console.log
> $LOG
/data/dfe/bin/dalmatinerfe start
./ddb.sh
./dfe.sh
创建 buckets:./ddb-admin buckets create test 1000ms 604800
查询 buckets:./ddb-admin buckets list
dalmatinerDB:192.168.200.51:5555
DalmatinerFE:http://192.168.200.51:8080
Grafana:http://192.168.200.51:3000 admin/admin

定时清理优化

points_per_file = 86400
lifetime = 86400
./ddb-admin buckets create test 1000ms 1d 1d