persister support cassandra in docker env

at present,dockerfile not support cassandra as backend database.
so we add this feature.

Change-Id: I575c0169451ec3e19d2bfc26696b6648d92a35d3
This commit is contained in:
zhangjianweibj 2019-03-15 14:44:42 +08:00
parent 4faa6172c1
commit 2ae274853d
2 changed files with 29 additions and 2 deletions

View File

@ -57,11 +57,19 @@ KAFKA_ALARM_HISTORY_BATCH_SIZE 1000 Kafka consumer ta
KAFKA_ALARM_HISTORY_WAIT_TIME 15 Seconds to wait if the batch size is not reached
KAFKA_METRICS_BATCH_SIZE 1000 Kafka consumer takes messages in a batch
KAFKA_METRICS_WAIT_TIME 15 Seconds to wait if the batch size is not reached
DATABASE_BACKEND influxdb Select for backend database
INFLUX_HOST influxdb The host for influxdb
INFLUX_PORT 8086 The port for influxdb
INFLUX_USER mon_persister The influx username
INFLUX_PASSWORD password The influx password
INFLUX_DB mon The influx database name
CASSANDRA_HOSTS 127.0.0.1 Cassandra node addresses
CASSANDRA_PORT 8086 Cassandra port number
KEY_SPACE monasca Keyspace name where metrics are stored
CASSANDRA_USER undefined Cassandra user name
CASSANDRA_PASSWORD undefined Cassandra password
CONNECTION_TIMEOUT 5 Cassandra timeout in seconds
RETENTION_POLICY 45 Data retention period in days
STAY_ALIVE_ON_FAILURE false If true, container runs 2 hours even start fails
============================== =============================== ================================================

View File

@ -9,11 +9,19 @@ debug = {{ DEBUG }}
verbose = {{ VERBOSE }}
[repositories]
# The driver to use for the metrics repository
{% if DATABASE_BACKEND == 'CASSANDRA' %}
# The cassandra driver to use for the metrics repository
metrics_driver = monasca_persister.repositories.cassandra.metrics_repository:MetricCassandraRepository
# The cassandra driver to use for the alarm state history repository
alarm_state_history_driver = monasca_persister.repositories.cassandra.alarm_state_history_repository:AlarmStateHistCassandraRepository
{% else %}
# The influxdb driver to use for the metrics repository
metrics_driver = monasca_persister.repositories.influxdb.metrics_repository:MetricInfluxdbRepository
# The driver to use for the alarm state history repository
# The influxdb driver to use for the alarm state history repository
alarm_state_history_driver = monasca_persister.repositories.influxdb.alarm_state_history_repository:AlarmStateHistInfluxdbRepository
{% endif %}
[zookeeper]
# Comma separated list of host:port
@ -56,9 +64,20 @@ max_buffer_size = 32768
zookeeper_path = /persister_partitions/metrics
num_processors = 1
{% if DATABASE_BACKEND == 'CASSANDRA' %}
[cassandra]
contact_points = {{CASSANDRA_HOSTS}}
port = {{ CASSANDRA_PORT }}
keyspace = {{ KEY_SPACE }}
user = {{ CASSANDRA_USER }}
password = {{ CASSANDRA_PASSWORD }}
connection_timeout = {{CONNECTION_TIMEOUT}}
retention_policy = {{RETENTION_POLICY}}
{% else %}
[influxdb]
database_name = {{ INFLUX_DB }}
ip_address = {{ INFLUX_HOST }}
port = {{ INFLUX_PORT }}
user = {{ INFLUX_USER }}
password = {{ INFLUX_PASSWORD }}
{% endif %}