New Install of Kong onto RHEL 6.8 using kong-0.9.8.el6.noarch.rpm.
Kong data store is a new Cassandra 2.2.8 DB with no Kong keyspace initially. Cassandra cluster is 2 nodes -- 1 node in each of 2 data centers.
Getting error when we first issue kong start
Error:
/usr/local/share/lua/5.1/kong/cmd/start.lua:37: /usr/local/share/lua/5.1/kong/cmd/start.lua:18: Error during migration 2016-02-25-160900_remove_null_consumer_id: [cassandra error] [Invalid] Predicates on non-primary-key columns (consumer_id) are not yet supported for non secondary index queries
We have implemented a work-around, which I will describe below, but I would appreciate help with understanding the root cause and a better solution.
Error logs:
2017/02/20 10:19:29 [verbose] prefix in use: /usr/local/kong
2017/02/20 10:19:29 [verbose] preparing nginx prefix directory at /usr/local/kong
2017/02/20 10:19:29 [verbose] saving serf identifier to /usr/local/kong/serf/serf.id
2017/02/20 10:19:29 [debug] searching for OpenResty 'resty' executable
2017/02/20 10:19:29 [debug] /usr/local/openresty/bin/resty -V: 'nginx version: openresty/1.11.2.1'
2017/02/20 10:19:29 [debug] found OpenResty 'resty' executable at /usr/local/openresty/bin/resty
2017/02/20 10:19:29 [verbose] saving serf shell script handler to /usr/local/kong/serf/serf_event.sh
2017/02/20 10:19:29 [verbose] SSL enabled, no custom certificate set: using default certificate
2017/02/20 10:19:29 [verbose] default SSL certificate found at /usr/local/kong/ssl/kong-default.crt
2017/02/20 10:19:29 [warn] ulimit is currently set to "1024". For better performance set it to at least "4096" using "ulimit -n"
2017/02/20 10:19:29 [verbose] running datastore migrations
2017/02/20 10:19:29 [warn] 21319#0: *2 [lua] log.lua:22: warn(): No cluster infos in shared dict cassandra, context: ngx.timer
2017/02/20 10:19:29 [info] migrating core for keyspace kong
2017/02/20 10:19:30 [info] core migrated up to: 2015-01-12-175310_skeleton
2017/02/20 10:19:39 [info] core migrated up to: 2015-01-12-175310_init_schema
2017/02/20 10:19:41 [info] core migrated up to: 2015-11-23-817313_nodes
2017/02/20 10:19:41 [verbose] could not start Kong, stopping services
2017/02/20 10:19:41 [verbose] leaving serf cluster
2017/02/20 10:19:41 [verbose] left serf cluster
2017/02/20 10:19:41 [verbose] stopping serf agent at /usr/local/kong/pids/serf.pid
2017/02/20 10:19:41 [debug] sending signal to pid at: /usr/local/kong/pids/serf.pid
2017/02/20 10:19:41 [debug] no pid file at: /usr/local/kong/pids/serf.pid
2017/02/20 10:19:41 [verbose] serf agent stopped
2017/02/20 10:19:41 [verbose] stopping dnsmasq at /usr/local/kong/pids/dnsmasq.pid
2017/02/20 10:19:41 [debug] sending signal to pid at: /usr/local/kong/pids/dnsmasq.pid
2017/02/20 10:19:41 [debug] no pid file at: /usr/local/kong/pids/dnsmasq.pid
2017/02/20 10:19:41 [verbose] stopped services
Error:
/usr/local/share/lua/5.1/kong/cmd/start.lua:37: /usr/local/share/lua/5.1/kong/cmd/start.lua:18: Error during migration 2016-02-25-160900_remove_null_consumer_id: [cassandra error] [Invalid] Predicates on non-primary-key columns (consumer_id) are not yet supported for non secondary index queries
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/cmd/start.lua:37: in function 'cmd_exec'
/usr/local/share/lua/5.1/kong/cmd/init.lua:89: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:89>
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/kong/cmd/init.lua:89: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:45>
/usr/local/bin/kong:13: in function 'file_gen'
init_worker_by_lua:38: in function <init_worker_by_lua:36>
[C]: in function 'pcall'
init_worker_by_lua:45: in function <init_worker_by_lua:43>
That migration ("2016-02-25-160900_remove_null_consumer_id") appears in /usr/local/share/lua/5.1/kong/dao/migrations/cassandra.lua as follows:
{
name = "2016-02-25-160900_remove_null_consumer_id",
up = function(_, _, dao)
local rows, err = dao.plugins:find_all {consumer_id = "00000000-0000-0000-0000-000000000000"}
if err then
return err
end
for _, row in ipairs(rows) do
row.consumer_id = nil
local _, err = dao.plugins:update(row, row, {full = true})
if err then
return err
end
end
end
}
I am not familiar enough with kong or lua to figure out exactly which table it was trying to update.
WORK-AROUND:
In the below 2 files, we commented out the "assert(dao:run_migrations())" line.
In /usr/local/share/lua/5.1/kong/cmd/start.lua
local dao = DAOFactory(conf)
local err
xpcall(function()
assert(prefix_handler.prepare_prefix(conf, args.nginx_conf))
--assert(dao:run_migrations())
In /usr/local/share/lua/5.1/kong.lua
local events = Events() -- retrieve node plugins
local dao = DAOFactory(config, events) -- instanciate long-lived DAO
--assert(dao:run_migrations()) -- migrating in case embedded in custom nginx
Since we are new to this whole stack (Kong, Cassandra, and LUA) we don't know what side-effects that this work-around will have aside from needing to manually run the migrations if/when we upgrade Kong. But my fear is that after we have started using Kong we won't be able to simply "reset" the schema without losing the metadata we have entered up to that point, and unless the migration code can detect what has already been implemented then we will wind up with errors and duplicates in the schema_migrations table. This is mentioned in https://github.com/Mashape/kong/issues/1118
This could either be a bug in Kong or a bug in Cassandra, or even a bug in the Cassandra driver for lua. However, I am past my limits on any of them.
I should note that we did not hit this problem in our first environment. The main difference I can think of is that the data store in the working environment is a 3-node Cassandra cluster in a single data center. The environment that isn't working is a multi-datacenter Cassandra cluster.
cluster_name: 'Cassandra PAT'
data_file_directories:
- /data/cassandra/data
commitlog_directory: /data/cassandra/commitlog
saved_caches_directory: /data/cassandra/saved_caches
seed_provider:
- class_name:
org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "10.900.12.10"
listen_address: 10.900.12.10
rpc_address: 0.0.0.0
broadcast_rpc_address: 10.900.12.10
endpoint_snitch: GossipingPropertyFileSnitch
cluster_name: 'Cassandra PAT'
data_file_directories:
- /data/cassandra/data
commitlog_directory: /data/cassandra/commitlog
saved_caches_directory: /data/cassandra/saved_caches
seed_provider:
- class_name:
org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "10.900.12.10"
listen_address: 10.800.17.30
rpc_address: 0.0.0.0
broadcast_rpc_address: 10.800.17.30
endpoint_snitch: GossipingPropertyFileSnitch
Because we are using the GossipingPropertyFileSnitch, need to also update/confirm cassandra-rackdc.properties file:
dc=dc1
rack=rack1
dc=dc2
rack=rack1
database = cassandra
cassandra_contact_points = 10.900.12.10,10.800.17.30
cassandra_port = 9042
cassandra_keyspace = kong
cassandra_consistency = LOCAL_QUORUM
cassandra_timeout = 5000
cassandra_ssl = off
cassandra_ssl_verify = off
cassandra_username = kong
cassandra_password = kong
cassandra_repl_strategy = NetworkTopologyStrategy
cassandra_data_centers = ldc:1,egi:1
Any insight into the root cause or another troubleshooting idea would be much appreciated.
Still getting the error. Right now I don't know of any FW rule issues, but maybe there are additional ports to consider.
Below is the complete output from the failing start command.
[root@sc1ucbtyapi01 ~]# kong start --vv
2017/02/27 09:21:58 [verbose] Kong: 0.9.8
2017/02/27 09:21:58 [debug] ngx_lua: 10006
2017/02/27 09:21:58 [debug] nginx: 1011002
2017/02/27 09:21:58 [debug] Lua: LuaJIT 2.1.0-beta2
2017/02/27 09:21:58 [debug] PRNG seed: 111655171229
2017/02/27 09:21:58 [verbose] no config file found at /etc/kong.conf
2017/02/27 09:21:58 [verbose] reading config file at /etc/kong/kong.conf
2017/02/27 09:21:58 [debug] admin_listen = "0.0.0.0:8001"
2017/02/27 09:21:58 [debug] anonymous_reports = true
2017/02/27 09:21:58 [debug] cassandra_consistency = "ALL"
2017/02/27 09:21:58 [debug] cassandra_contact_points = {"10.211.12.10","10.218.17.30"}
2017/02/27 09:21:58 [debug] cassandra_data_centers = {"ldc:1","egi:1"}
2017/02/27 09:21:58 [debug] cassandra_keyspace = "kong"
2017/02/27 09:21:58 [debug] cassandra_password = "******"
2017/02/27 09:21:58 [debug] cassandra_port = 9042
2017/02/27 09:21:58 [debug] cassandra_repl_factor = 1
2017/02/27 09:21:58 [debug] cassandra_repl_strategy = "NetworkTopologyStrategy"
2017/02/27 09:21:58 [debug] cassandra_ssl = false
2017/02/27 09:21:58 [debug] cassandra_ssl_verify = false
2017/02/27 09:21:58 [debug] cassandra_timeout = 5000
2017/02/27 09:21:58 [debug] cassandra_username = "kong"
2017/02/27 09:21:58 [debug] cluster_listen = "0.0.0.0:7946"
2017/02/27 09:21:58 [debug] cluster_listen_rpc = "127.0.0.1:7373"
2017/02/27 09:21:58 [debug] cluster_profile = "wan"
2017/02/27 09:21:58 [debug] cluster_ttl_on_failure = 3600
2017/02/27 09:21:58 [debug] custom_plugins = {}
2017/02/27 09:21:58 [debug] database = "cassandra"
2017/02/27 09:21:58 [debug] dnsmasq = true
2017/02/27 09:21:58 [debug] dnsmasq_port = 8053
2017/02/27 09:21:58 [debug] log_level = "notice"
2017/02/27 09:21:58 [debug] lua_code_cache = "on"
2017/02/27 09:21:58 [debug] lua_package_cpath = ""
2017/02/27 09:21:58 [debug] lua_package_path = "?/init.lua;./kong/?.lua"
2017/02/27 09:21:58 [debug] lua_ssl_verify_depth = 1
2017/02/27 09:21:58 [debug] mem_cache_size = "128m"
2017/02/27 09:21:58 [debug] nginx_daemon = "on"
2017/02/27 09:21:58 [debug] nginx_optimizations = true
2017/02/27 09:21:58 [debug] nginx_worker_processes = "auto"
2017/02/27 09:21:58 [debug] pg_database = "kong"
2017/02/27 09:21:58 [debug] pg_host = "127.0.0.1"
2017/02/27 09:21:58 [debug] pg_port = 5432
2017/02/27 09:21:58 [debug] pg_ssl = false
2017/02/27 09:21:58 [debug] pg_ssl_verify = false
2017/02/27 09:21:58 [debug] pg_user = "kong"
2017/02/27 09:21:58 [debug] prefix = "/usr/local/kong/"
2017/02/27 09:21:58 [debug] proxy_listen = "0.0.0.0:8000"
2017/02/27 09:21:58 [debug] proxy_listen_ssl = "0.0.0.0:8443"
2017/02/27 09:21:58 [debug] serf_path = "serf"
2017/02/27 09:21:58 [debug] ssl = true
2017/02/27 09:21:58 [verbose] prefix in use: /usr/local/kong
2017/02/27 09:21:58 [verbose] preparing nginx prefix directory at /usr/local/kong
2017/02/27 09:21:58 [verbose] saving serf identifier to /usr/local/kong/serf/serf.id
2017/02/27 09:21:58 [debug] searching for OpenResty 'resty' executable
2017/02/27 09:21:58 [debug] /usr/local/openresty/bin/resty -V: 'nginx version: openresty/1.11.2.1'
2017/02/27 09:21:58 [debug] found OpenResty 'resty' executable at /usr/local/openresty/bin/resty
2017/02/27 09:21:58 [verbose] saving serf shell script handler to /usr/local/kong/serf/serf_event.sh
2017/02/27 09:21:58 [verbose] SSL enabled, no custom certificate set: using default certificate
2017/02/27 09:21:58 [verbose] default SSL certificate found at /usr/local/kong/ssl/kong-default.crt
2017/02/27 09:21:58 [warn] ulimit is currently set to "1024". For better performance set it to at least "4096" using "ulimit -n"
2017/02/27 09:21:58 [verbose] running datastore migrations
2017/02/27 09:21:58 [warn] 13324#0: *2 [lua] log.lua:22: warn(): No cluster infos in shared dict cassandra, context: ngx.timer
2017/02/27 09:21:58 [info] migrating core for keyspace kong
2017/02/27 09:22:00 [info] core migrated up to: 2015-01-12-175310_skeleton
2017/02/27 09:22:09 [info] core migrated up to: 2015-01-12-175310_init_schema
2017/02/27 09:22:10 [info] core migrated up to: 2015-11-23-817313_nodes
2017/02/27 09:22:10 [verbose] could not start Kong, stopping services
2017/02/27 09:22:10 [verbose] leaving serf cluster
2017/02/27 09:22:11 [verbose] left serf cluster
2017/02/27 09:22:11 [verbose] stopping serf agent at /usr/local/kong/pids/serf.pid
2017/02/27 09:22:11 [debug] sending signal to pid at: /usr/local/kong/pids/serf.pid
2017/02/27 09:22:11 [debug] no pid file at: /usr/local/kong/pids/serf.pid
2017/02/27 09:22:11 [verbose] serf agent stopped
2017/02/27 09:22:11 [verbose] stopping dnsmasq at /usr/local/kong/pids/dnsmasq.pid
2017/02/27 09:22:11 [debug] sending signal to pid at: /usr/local/kong/pids/dnsmasq.pid
2017/02/27 09:22:11 [debug] no pid file at: /usr/local/kong/pids/dnsmasq.pid
2017/02/27 09:22:11 [verbose] stopped services
Error:
/usr/local/share/lua/5.1/kong/cmd/start.lua:37: /usr/local/share/lua/5.1/kong/cmd/start.lua:18: Error during migration 2016-02-25-160900_remove_null_consumer_id: [cassandra error] [Invalid] Predicates on non-primary-key columns (consumer_id) are not yet supported for non secondary index queries
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/cmd/start.lua:37: in function 'cmd_exec'
/usr/local/share/lua/5.1/kong/cmd/init.lua:89: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:89>
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/kong/cmd/init.lua:89: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:45>
/usr/local/bin/kong:13: in function 'file_gen'
init_worker_by_lua:38: in function <init_worker_by_lua:36>
[C]: in function 'pcall'
init_worker_by_lua:45: in function <init_worker_by_lua:43>
Kong keyspace at the time of the error…. Note that there is no index on
plugins.consumer_id
cqlsh> desc kong
CREATE KEYSPACE kong WITH replication = {'class': 'NetworkTopologyStrategy', 'egi': '1', 'ldc': '1'} AND durable_writes = true;
CREATE TABLE kong.schema_migrations (
id text PRIMARY KEY,
migrations list<text>
) WITH 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'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
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 = '99.0PERCENTILE';
CREATE TABLE kong.plugins (
id uuid,
name text,
api_id uuid,
config text,
consumer_id uuid,
created_at timestamp,
enabled boolean,
PRIMARY KEY (id, name)
) WITH CLUSTERING ORDER BY (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'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
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 = '99.0PERCENTILE';
CREATE INDEX plugins_api_id_idx ON kong.plugins (api_id);
CREATE TABLE kong.nodes (
name text PRIMARY KEY,
cluster_listening_address text,
created_at timestamp
) WITH 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'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 3600
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 = '99.0PERCENTILE';
CREATE INDEX nodes_cluster_listening_address_idx ON kong.nodes (cluster_listening_address);
CREATE TABLE kong.consumers (
id uuid PRIMARY KEY,
created_at timestamp,
custom_id text,
username text
) WITH 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'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
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 = '99.0PERCENTILE';
CREATE INDEX consumers_username_idx ON kong.consumers (username);
CREATE INDEX consumers_custom_id_idx ON kong.consumers (custom_id);
CREATE TABLE kong.apis (
id uuid PRIMARY KEY,
created_at timestamp,
name text,
preserve_host boolean,
request_host text,
request_path text,
strip_request_path boolean,
upstream_url text
) WITH 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'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
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 = '99.0PERCENTILE';
CREATE INDEX apis_request_host_idx ON kong.apis (request_host);
----------------------------------------------------------------------------
time correct to within 12714 ms
polling server every 64 s
time correct to within 42 ms
polling server every 256 s
--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+...@googlegroups.com.
To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.
To view this discussion on the web visit https://groups.google.com/d/msgid/konglayer/915f7b83-d5ac-4eda-8ed3-0a526438b7fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.