Comment 126 for bug 1733027

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/44483
Committed: http://github.com/Juniper/contrail-analytics/commit/fc282fce06a322ca7b831be051afa60664470017
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit fc282fce06a322ca7b831be051afa60664470017
Author: zcui <email address hidden>
Date: Wed Jul 4 21:44:48 2018 -0700

Add contrail-collector to zookeeper

Problem description:
To multi nodes cluster, one node down, all other nodes'
analytics_api/alarmgen state is initing but no active

Solution:
Currently we use redis to get both redis state and collecor state.
We need seperate them.
The solution is add collector to zookeeper, analytics_api/alarmgen
to get collector state with zookeeper, and use redis ping to monitor
redis state.
The znode is like
/analytics-discovery-/Collector/{collector_ip1}
/analytics-discovery-/Collector/{collector_ip2}
......
/analytics-discovery-/Collector is PERSISTENT znode, {collector_ip1}
is EPHEMERAL znode, and znode value is
{"hostname": hostname,
"instance_id": process_id,
"ip_address": collector ip,
"module_id":"contrail-collector",
"type_name":"Analytics"}

This is second commit to implment in contrail-analytics

Test case:
3 nodes cluster: n1, n2, n3 run contrail-analytics
(1) n1 stop redis-server:
result: all analytics-api/alarm-gen in initializing state,
n1 collector in initializing state
(2) n1 stop collector:
result: n1 analytics-api/alarm-gen in initializing state
all other nodes analytics-api/alarm-gen is active
(3) n1 start redis-server:
result: all analytics-api/alarm-gen in active state
(4) n1 start collector:
result: all analytics-api/alarm-gen in active state
(5) shudown n1:
result: all other analytics-api/alarm-gen in active state

Pending issue 1:
when alarmgen state changed from active to init, will not update
AlarmgenPartition UVE. It will be fixed seperately.(Bug #1794632)
Peding issue 2:
Shutdown one server lead kafka lib callback to down other server's
alarmgen. (Bug #1794904)

Closes-bug: 1733027

Conflicts:
 contrail-collector/main.cc
 contrail-collector/viz_collector.cc
 contrail-collector/viz_collector.h

Change-Id: I46c97553b303cdaa85ac3cac06587690a3771e44