Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cassandra) add a 'port' option for clusters #1151

Merged
merged 1 commit into from
Apr 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This release includes support for PostgreSQL as Kong's primary datastore!

### Fixed

- Introduce a new `port` option when connecting to your Cassandra cluster instead of using the CQL default (9042). [#1139](https://github.com/Mashape/kong/issues/1139)
- Plugins
- Request/Response Transformer: add missing migrations for upgrades from ` <= 0.5.x`. [#1064](https://github.com/Mashape/kong/issues/1064)
- OAuth2
Expand Down
4 changes: 2 additions & 2 deletions kong-0.8.0rc2-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = {
"yaml ~> 1.1.2-1",
"lapis ~> 1.3.1-1",
"stringy ~> 0.4-1",
"lua-cassandra ~> 0.5.0",
"lua-cassandra ~> 0.5.1",
"pgmoon ~> 1.4.0",
"multipart ~> 0.3-2",
"lua-path ~> 0.2.3-1",
Expand Down Expand Up @@ -264,7 +264,7 @@ build = {
["kong.plugins.datadog.handler"] = "kong/plugins/datadog/handler.lua",
["kong.plugins.datadog.schema"] = "kong/plugins/datadog/schema.lua",
["kong.plugins.datadog.statsd_logger"] = "kong/plugins/datadog/statsd_logger.lua",

["kong.plugins.statsd.handler"] = "kong/plugins/statsd/handler.lua",
["kong.plugins.statsd.schema"] = "kong/plugins/statsd/schema.lua",
["kong.plugins.statsd.statsd_logger"] = "kong/plugins/statsd/statsd_logger.lua"
Expand Down
8 changes: 6 additions & 2 deletions kong.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
# encrypt: "foo"

######
## The TTL (time to live), in seconds, of a node in the cluster when it stops sending healthcheck pings, maybe
## because of a failure. If the node is not able to send a new healthcheck before the expiration, then new nodes
## The TTL (time to live), in seconds, of a node in the cluster when it stops sending healthcheck pings, maybe
## because of a failure. If the node is not able to send a new healthcheck before the expiration, then new nodes
## in the cluster will stop attempting to connect to it on startup.
# ttl_on_failure: 3600

Expand Down Expand Up @@ -120,6 +120,10 @@
# contact_points:
# - "127.0.0.1:9042"

## Port on which your cluster's peers (other than your contact_points)
## are listening on.
# port: 9042

######
## Name of the keyspace used by Kong. Will be created if it does not exist.
# keyspace: kong
Expand Down
3 changes: 3 additions & 0 deletions kong/dao/cassandra_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function CassandraDB:new(options)
prepared_shm = "cassandra_prepared",
contact_points = options.contact_points,
keyspace = options.keyspace,
protocol_options = {
default_port = options.port
},
query_options = {
prepare = true
},
Expand Down
3 changes: 2 additions & 1 deletion kong/tools/config_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,15 @@ return {
type = "table",
content = {
["contact_points"] = {type = "array", default = {"127.0.0.1:9042"}},
["port"] = {type = "number", default = 9042},
["keyspace"] = {type = "string", default = "kong"},
["timeout"] = {type = "number", default = 5000},
["replication_strategy"] = {type = "string", default = "SimpleStrategy", enum = {"SimpleStrategy", "NetworkTopologyStrategy"}},
["replication_factor"] = {type = "number", default = 1},
["data_centers"] = {type = "table", default = {}},
["username"] = {type = "string", nullable = true},
["password"] = {type = "string", nullable = true},
["consistency"] = {type = "string", default = "ONE", enum = {"ANY", "ONE", "TWO", "THREE", "QUORUM", "ALL", "LOCAL_QUORUM",
["consistency"] = {type = "string", default = "ONE", enum = {"ANY", "ONE", "TWO", "THREE", "QUORUM", "ALL", "LOCAL_QUORUM",
"EACH_QUORUM", "SERIAL", "LOCAL_SERIAL", "LOCAL_ONE"}},
["ssl"] = {
type = "table",
Expand Down