我正在运行与kafka合作已有一年的服务,并且没有发生领导者的自发变化.但是在过去的两周里,这种情况经常发生.卡夫卡登录:
什么可以导致转换领导者?如果某些kafka文档中有信息 - 请 - 只需指向该链接即可.我没找到.
系统配置
kafka版本:kafka_2.10-0.8.2.1
os:Red Hat Enterprise Linux Server 6.5版(圣地亚哥)
server.properties(与默认值不同):
环境:postgres:9.5
表:
segmentation=> \d+ sourceTable;
Table
"sourceTable" Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------+--------------------------+------------------------+----------+--------------+-------------
tracking_id | character varying(40) | not null | extended | |
attributes | jsonb | not null | extended | |
last_modification_timestamp | timestamp with time zone | not null default now() | plain | |
version | bigint | not null default 1 | plain | |
Indexes:
"client_attributes_pkey" PRIMARY KEY, btree (tracking_id)
Run Code Online (Sandbox Code Playgroud)
属性字段为jsonb。它可能是一个巨大的json。因此Postgres创建了TOAST表来存储该列。
TOAST表的统计数据
segmentation=> select * from …
Run Code Online (Sandbox Code Playgroud) 在postgres(第9.5节,如果有关系):
create table json_test(
id varchar NOT NULL,
data jsonb NOT NULL,
PRIMARY KEY(id)
);
Run Code Online (Sandbox Code Playgroud)
数据是json并包含数组的数组
{
"attribute": "0",
"array1": [{
"id": "a12",
"attribute": "1",
"array2": [{
"id": "a21",
"attribute": "21"
}]
},
{
"id": "a12",
"attribute": "2",
"array2": [{
"id": "22",
"attribute": "22"
}]
}]
}
Run Code Online (Sandbox Code Playgroud)
需要:
select id from json_test where
json_test->>'attribute'='0' and
array1.[id='a12'].array2.attribute='22'
Run Code Online (Sandbox Code Playgroud)
查询应该意味着:给我所有的ID
诀窍是如何实现最后一个条件.
另一个例子:
{
"attribute": "0",
"array1": [{
"id": "a12",
"attribute": "1",
"array2": [{
"id": "a21_1",
"attribute_1": "21_1"
},{
"id": "a21_2", …
Run Code Online (Sandbox Code Playgroud)