Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit baa8a5b

Browse files
author
Anthony Woods
committed
update to work with cosmosdb
1 parent a5d95d6 commit baa8a5b

File tree

19 files changed

+616
-46
lines changed

19 files changed

+616
-46
lines changed

cmd/mt-split-metrics-by-ttl/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ var (
3232
cassandraUsername = flag.String("cassandra-username", "cassandra", "username for authentication")
3333
cassandraPassword = flag.String("cassandra-password", "cassandra", "password for authentication")
3434

35+
cassandraDisableInitialHostLookup = flag.Bool("cassandra-disable-initial-host-lookup", false, "instruct the driver to not attempt to get host info from the system.peers table")
36+
3537
// hard coded to default because those have no effect in the case of this tool anyway
3638
windowFactor = 20
3739
cassandraOmitReadTimeout = 60
@@ -70,7 +72,7 @@ func main() {
7072
panic(fmt.Sprintf("Error creating directory: %s", err))
7173
}
7274

73-
store, err := cassandra.NewCassandraStore(*cassandraAddrs, *cassandraKeyspace, *cassandraConsistency, *cassandraCaPath, *cassandraUsername, *cassandraPassword, *cassandraHostSelectionPolicy, *cassandraTimeout, cassandraReadConcurrency, cassandraReadConcurrency, cassandraReadQueueSize, 0, *cassandraRetries, *cqlProtocolVersion, windowFactor, cassandraOmitReadTimeout, *cassandraSSL, *cassandraAuth, *cassandraHostVerification, *cassandraCreateKeyspace, *cassandraSchemaFile, ttls)
75+
store, err := cassandra.NewCassandraStore(*cassandraAddrs, *cassandraKeyspace, *cassandraConsistency, *cassandraCaPath, *cassandraUsername, *cassandraPassword, *cassandraHostSelectionPolicy, *cassandraTimeout, cassandraReadConcurrency, cassandraReadConcurrency, cassandraReadQueueSize, 0, *cassandraRetries, *cqlProtocolVersion, windowFactor, cassandraOmitReadTimeout, *cassandraSSL, *cassandraAuth, *cassandraHostVerification, *cassandraCreateKeyspace, *cassandraSchemaFile, ttls, *cassandraDisableInitialHostLookup)
7476
if err != nil {
7577
panic(fmt.Sprintf("Failed to instantiate cassandra: %s", err))
7678
}

cmd/mt-store-cat/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ var (
5353
cassandraPassword = flag.String("cassandra-password", "cassandra", "password for authentication")
5454
cassandraOmitReadTimeout = flag.Int("cassandra-omit-read-timeout", 60, "if a read is older than this, it will directly be omitted without executing")
5555

56+
cassandraDisableInitialHostLookup = flag.Bool("cassandra-disable-initial-host-lookup", false, "instruct the driver to not attempt to get host info from the system.peers table")
57+
5658
// our own flags
5759
from = flag.String("from", "-24h", "get data from (inclusive). only for points and points-summary format")
5860
to = flag.String("to", "now", "get data until (exclusive). only for points and points-summary format")
@@ -163,7 +165,7 @@ func main() {
163165
}
164166
}
165167

166-
store, err := cassandra.NewCassandraStore(*cassandraAddrs, *cassandraKeyspace, *cassandraConsistency, *cassandraCaPath, *cassandraUsername, *cassandraPassword, *cassandraHostSelectionPolicy, *cassandraTimeout, *cassandraReadConcurrency, *cassandraReadConcurrency, *cassandraReadQueueSize, 0, *cassandraRetries, *cqlProtocolVersion, *windowFactor, *cassandraOmitReadTimeout, *cassandraSSL, *cassandraAuth, *cassandraHostVerification, *cassandraCreateKeyspace, *cassandraSchemaFile, nil)
168+
store, err := cassandra.NewCassandraStore(*cassandraAddrs, *cassandraKeyspace, *cassandraConsistency, *cassandraCaPath, *cassandraUsername, *cassandraPassword, *cassandraHostSelectionPolicy, *cassandraTimeout, *cassandraReadConcurrency, *cassandraReadConcurrency, *cassandraReadQueueSize, 0, *cassandraRetries, *cqlProtocolVersion, *windowFactor, *cassandraOmitReadTimeout, *cassandraSSL, *cassandraAuth, *cassandraHostVerification, *cassandraCreateKeyspace, *cassandraSchemaFile, nil, *cassandraDisableInitialHostLookup)
167169
if err != nil {
168170
log.Fatal(4, "failed to initialize cassandra. %s", err)
169171
}

cmd/mt-update-ttl/main.go

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ var (
3636
cassandraUsername = flag.String("cassandra-username", "cassandra", "username for authentication")
3737
cassandraPassword = flag.String("cassandra-password", "cassandra", "password for authentication")
3838

39+
cassandraDisableInitialHostLookup = flag.Bool("cassandra-disable-initial-host-lookup", false, "instruct the driver to not attempt to get host info from the system.peers table")
40+
3941
startTs = flag.Int("start-timestamp", 0, "timestamp at which to start, defaults to 0")
4042
endTs = flag.Int("end-timestamp", math.MaxInt32, "timestamp at which to stop, defaults to int max")
4143
numThreads = flag.Int("threads", 1, "number of workers to use to process data")
@@ -100,6 +102,7 @@ func NewCassandraStore() (*gocql.Session, error) {
100102
cluster.ProtoVersion = *cqlProtocolVersion
101103
cluster.Keyspace = *cassandraKeyspace
102104
cluster.RetryPolicy = &gocql.SimpleRetryPolicy{NumRetries: *cassandraRetries}
105+
cluster.DisableInitialHostLookup = *cassandraDisableInitialHostLookup
103106

104107
switch *cassandraHostSelectionPolicy {
105108
case "roundrobin":

cmd/mt-whisper-importer-writer/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ var (
9494

9595
cassandraSchemaFile = flag.String("cassandra-schema-file", "/etc/metrictank/schema-store-cassandra.toml", "File containing the needed schemas in case database needs initializing")
9696

97+
cassandraDisableInitialHostLookup = flag.Bool("cassandra-disable-initial-host-lookup", false, "instruct the driver to not attempt to get host info from the system.peers table")
98+
9799
gitHash = "(none)"
98100
)
99101

@@ -153,7 +155,7 @@ func main() {
153155
log.SetLevel(log.InfoLevel)
154156
}
155157

156-
store, err := cassandraStore.NewCassandraStore(*cassandraAddrs, *cassandraKeyspace, *cassandraConsistency, *cassandraCaPath, *cassandraUsername, *cassandraPassword, *cassandraHostSelectionPolicy, *cassandraTimeout, *cassandraReadConcurrency, *cassandraReadConcurrency, *cassandraReadQueueSize, 0, *cassandraRetries, *cqlProtocolVersion, *windowFactor, 60, *cassandraSSL, *cassandraAuth, *cassandraHostVerification, *cassandraCreateKeyspace, *cassandraSchemaFile, nil)
158+
store, err := cassandraStore.NewCassandraStore(*cassandraAddrs, *cassandraKeyspace, *cassandraConsistency, *cassandraCaPath, *cassandraUsername, *cassandraPassword, *cassandraHostSelectionPolicy, *cassandraTimeout, *cassandraReadConcurrency, *cassandraReadConcurrency, *cassandraReadQueueSize, 0, *cassandraRetries, *cqlProtocolVersion, *windowFactor, 60, *cassandraSSL, *cassandraAuth, *cassandraHostVerification, *cassandraCreateKeyspace, *cassandraSchemaFile, nil, *cassandraDisableInitialHostLookup)
157159
if err != nil {
158160
panic(fmt.Sprintf("Failed to initialize cassandra: %q", err))
159161
}

docker/docker-chaos/metrictank.ini

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ cassandra-auth = false
7272
cassandra-username = cassandra
7373
# password for authentication
7474
cassandra-password = cassandra
75+
# instruct the driver to not attempt to get host info from the system.peers table
76+
cassandra-disable-initial-host-lookup = false
7577

7678
## Profiling and logging ##
7779

@@ -356,6 +358,8 @@ password = cassandra
356358
create-keyspace = false
357359
# File containing the needed schemas in case database needs initializing
358360
schema-file = /etc/metrictank/schema-idx-cassandra.toml
361+
# instruct the driver to not attempt to get host info from the system.peers table
362+
disable-initial-host-lookup = false
359363

360364
### in-memory only
361365
[memory-idx]

docker/docker-cluster/metrictank.ini

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ cassandra-auth = false
7272
cassandra-username = cassandra
7373
# password for authentication
7474
cassandra-password = cassandra
75+
# instruct the driver to not attempt to get host info from the system.peers table
76+
cassandra-disable-initial-host-lookup = false
7577

7678
## Profiling and logging ##
7779

@@ -356,6 +358,8 @@ password = cassandra
356358
create-keyspace = false
357359
# File containing the needed schemas in case database needs initializing
358360
schema-file = /etc/metrictank/schema-idx-cassandra.toml
361+
# instruct the driver to not attempt to get host info from the system.peers table
362+
disable-initial-host-lookup = false
359363

360364
### in-memory only
361365
[memory-idx]
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
version: '2'
2+
3+
services:
4+
metrictank:
5+
hostname: metrictank
6+
image: grafana/metrictank
7+
ports:
8+
- "6060:6060"
9+
- "2003:2003"
10+
volumes:
11+
- ../../build/metrictank:/usr/bin/metrictank
12+
- ./metrictank.ini:/etc/metrictank/metrictank.ini
13+
- ./storage-schemas.conf:/etc/metrictank/storage-schemas.conf
14+
- ./storage-aggregation.conf:/etc/metrictank/storage-aggregation.conf
15+
environment:
16+
WAIT_HOSTS: kafka:9092
17+
WAIT_TIMEOUT: 60
18+
MT_STATS_ADDR: graphite:2003
19+
MT_CASSANDRA_ADDRS: <addr>
20+
MT_CASSANDRA_SSL: "true"
21+
MT_CASSANDRA_HOST_VERIFICATION: "false"
22+
MT_CASSANDRA_AUTH: "true"
23+
MT_CASSANDRA_USERNAME: <user>
24+
MT_CASSANDRA_PASSWORD: <pass>
25+
MT_CASSANDRA_IDX_HOSTS: <addr>
26+
MT_CASSANDRA_IDX_NUM_CONNS: 1
27+
MT_CASSANDRA_IDX_SSL: "true"
28+
MT_CASSANDRA_IDX_HOST_VERIFICATION: "false"
29+
MT_CASSANDRA_IDX_AUTH: "true"
30+
MT_CASSANDRA_IDX_USERNAME: <user>
31+
MT_CASSANDRA_IDX_PASSWORD: <pass>
32+
links:
33+
- kafka
34+
35+
kafka:
36+
hostname: kafka
37+
image: raintank/kafka:latest
38+
environment:
39+
ADVERTISED_HOST: kafka
40+
NUM_PARTITIONS: 8
41+
ports:
42+
- "2181:2181"
43+
- "9092:9092"
44+
- "9999:9999"
45+
volumes:
46+
- /tmp/kafka-logs
47+
48+
graphite:
49+
hostname: graphite
50+
image: graphiteapp/graphite-statsd:latest
51+
ports:
52+
- "8080:80"
53+
54+
grafana:
55+
hostname: grafana
56+
image: grafana/grafana:latest
57+
ports:
58+
- "3000:3000"
59+
60+
tsdb-gw:
61+
hostname: tsdb-gw
62+
image: raintank/tsdb-gw:latest
63+
ports:
64+
- "8081:80"
65+
environment:
66+
GW_GRAPHITE_URL: http://metrictank:6060
67+
GW_METRICS_PUBLISH: "true"
68+
GW_METRICS_KAFKA_COMP: snappy
69+
GW_KAFKA_TCP_ADDR: kafka:9092
70+
GW_STATS_ENABLED: "true"
71+
GW_STATS_PREFIX: "tsdb-gw.stats.dev.tsdbgw_tsdb-gw_1"
72+
GW_STATS_ADDR: "graphite:2003"

0 commit comments

Comments
 (0)