參考網頁:
OpenNMS Installation Guide
根據官方網站上的解釋:
Newts 是基於 Apache Cassandra 的時間序列資料儲存,是一個持久性的策略,可以用來取代 JRobin 或是 RRDtool。
在 CentOS 7.x 下安裝
1. 新增 DataStax 套件庫設定檔
# vim /etc/yum.repos.d/datastax.repo
[datastax]
name = “DataStax Repo for Apache Cassandra”
baseurl = https://rpm.datastax.com/community
enabled = 1
gpgcheck = 1
2. 安裝 GPG Key
# rpm –import https://rpm.datastax.com/rpm/repo_key
3. 更新套件庫
# yum update[@more@]4. 安裝 Cassandra 3.0.x package
# yum install dsc30
5. 啟動 Cassandra 服務
# systemctl enable cassandra
cassandra.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig cassandra on
# systemctl start cassandra
6. 設定 OpenNMS Horizon
# cp /opt/opennms/etc/opennms.properties /opt/opennms/etc/opennms.properties.$(date +%F)
將 false 改為 true
# sed -i ‘/rrd.storeByForeignSource/s/false/true/’ /opt/opennms/etc/opennms.properties
取消前面的註解,並將 rrd 改為 newts
# sed -i ‘/^#org.opennms.timeseries/s/#org.opennms.timeseries.strategy=rrd/org.opennms.timeseries.strategy=newts/’ /opt/opennms/etc/opennms.properties
取消前面的註解
# sed -i ‘/newts.config.hostname/s/^#org/org/’ /opt/opennms/etc/opennms.properties
# sed -i ‘/keyspace/s/^#org/org/’ /opt/opennms/etc/opennms.properties
# sed -i ‘/9042/s/^#org/org/’ /opt/opennms/etc/opennms.properties
7. 初始化 newts
# /opt/opennms/bin/newts init
8. 進行驗證
# cqlsh 127.0.0.1 9042
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.9 | CQL spec 3.4.0 | Native protocol v4]
Use HELP for help.
cqlsh> use newts;
cqlsh:newts> describe table terms;
CREATE TABLE newts.terms (
context text,
field text,
value text,
resource text,
PRIMARY KEY ((context, field, value), resource)
) WITH CLUSTERING ORDER BY (resource ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {‘keys’: ‘ALL’, ‘rows_per_partition’: ‘NONE’}
AND comment = ”
AND compaction = {‘class’: ‘org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy’, ‘max_threshold’: ’32’, ‘min_threshold’: ‘4’}
AND compression = {‘chunk_length_in_kb’: ’64’, ‘class’: ‘org.apache.cassandra.io.compress.LZ4Compressor’}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = ’99PERCENTILE’;
cqlsh:newts> describe table samples;
CREATE TABLE newts.samples (
context text,
partition int,
resource text,
collected_at timestamp,
metric_name text,
attributes map<text, text>,
value blob,
PRIMARY KEY ((context, partition, resource), collected_at, metric_name)
) WITH CLUSTERING ORDER BY (collected_at ASC, metric_name ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {‘keys’: ‘ALL’, ‘rows_per_partition’: ‘NONE’}
AND comment = ”
AND compaction = {‘class’: ‘org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy’, ‘max_threshold’: ’32’, ‘min_threshold’: ‘4’}
AND compression = {‘chunk_length_in_kb’: ’64’, ‘class’: ‘org.apache.cassandra.io.compress.LZ4Compressor’}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = ’99PERCENTILE’;
cqlsh:newts> quit
9. 重新啟動 OpenNMS
# systemctl restart opennms