Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Follow these steps to access Kafka from outside the Kuberenetes

1) Update the Kafka service YAML to add service type as LoadBalancer and install the DMaaP chart

 Image Removed

2) Get the external  IP address by running the below kubectl command. Kubernetes Dashboard also shows the external IP address.

       kubectl get services/message-router-kafka  -o jsonpath='{.status.loadBalancer.ingress[0].ip}'

Image Removed

         

3) Update the KAFKA_ADVERTISED_LISTENERS environment variable  in Kafka Deployment YAML with the external IP from step 2 and redeploy the DMaaPImage Removed

Now Kafka can be accessed outside Kubernetes cluster  at <external IP>:9092MirrorMaker is a stand-alone tool for copying data between two Apache Kafka clusters. It is a Kafka consumer and producer hooked together. Data is read from topics in the origin cluster and written to a topic with the same name in the destination cluster. You can run many such mirroring processes to increase throughput and for fault-tolerance

DMaaP Message Router offers the following REST API to create a mirror maker process, update a mirror maker process etc.  


Mirror Maker


Expand
titleCreate Mirror Maker

POST /mirrormakers/create

This API will create a Mirror Maker.

Required AAF Permissions : org.onap.dmaap.mr.mirrormaker|*|admin

Request Payload:

Parameter NameReq'd

Description


createMirrorMakerYMirror Maker Request Object
nameYUnique Name for the MirrorMaker A-Z 1-0 only
consumerYConsumer hostname/IP Address 
producerYProducer hostname/IP Address
numStreamsOptionalNumber of consumer threads to start. (If not provided default is 1)
whitelistOptionalTopic names to be whitelisted. This can be provided later using createWhitelist API
enablelogCheckOptional


Enable error log monitoring on the MirrorMaker thread. Default values is False.

If not provided error log is not monitored.


{
"createMirrorMaker":
{
"name": "centraltoedge",
"consumer": "10.12.6.98:30491",
"producer": "10.12.5.108:30491",
"numStreams": "3",
"whitelist": "org.onap.dmaap.mr.mrtesttopic",
"enablelogCheck": "true"
}
}


Response Payload:

{
"listMirrorMaker": {
"name": "centraltoedge",
"producer": "10.12.5.108:30491",
"whitelist": "org.onap.dmaap.mr.mrtesttopic",
"enablelogCheck": true,
"consumer": "10.12.6.98:30491",
"status": "RESTARTING",
"numStreams": 3
}
}


Error Messages:

Error ResonError Message
No AAF Mirror Maker Admin permissionNo Mirror Maker Admin permission.
Creating new MirrorMaker with existing MirrroMaker nameMirrorMaker <MM Name> already exists
Incorrect payloadThis is not a CreateMirrorMaker request. Please try again.
Consumer field/value missingPlease provide Consumer host:port details
Producer field/value missingPlease provide Producer host:port details
Incorrect naming conventionMirror Maker name can only contain alpha numeric
Incorrect JSONIncorrect JSON object.Incorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 seconds)listMirrorMaker is not available, please make sure MirrorMakerAgent is running



Expand
titleUpdate Mirror Maker

POST /mirrormakers/update

This API is used to update an existing MirrorMaker. 

Required AAF Permissions: org.onap.dmaap.mr.mirrormaker|*|admin

Request Payload:

Parameter NameReq'dDescription
updateMirrorMakerYMirror Maker Request Object
nameYExisting MIrrorMaker name
consumerOptionalConsumer hostname/IP Address 
producerOptionalProducer hostname/IP Address
numStreamsOptionalUpdate Number of consumer threads.
enablelogCheckOptionalEnable/Disable error log monitoring on the MirrorMaker thread


{
"updateMirrorMaker":{
"name":"centraltoedge",
"consumer": "10.12.6.98:30491",
"producer": "10.12.5.108:30491",
"numStreams":"2",
"enablelogCheck":"true"
}
}

Response Payload:

{
"listMirrorMaker": {
"name": "centraltoedge",
"producer": "10.12.5.108:30491",
"whitelist": "org.onap.dmaap.mr.mrtesttopic",
"enablelogCheck": true,
"consumer": "10.12.6.98:30491",
"status": "RESTARTING",
"numStreams": 2
}
}

Error Messages:

Error ReasonError Message
No AAF Mirror Maker Admin permissionNo Mirror Maker Admin permission.
Incorrect MirrorMaker name that does not exist MirrorMaker <MM Name> does not exist
Incorrect payloadThis is not a UpdateMirrorMaker request. Please try again.
Consumer value not providedPlease provide Consumer host:port details
Producer value not providedPlease provide Producer host:port details
Incorrect naming conventionMirror Maker name can only contain alpha numeric
Could not parse JSON.Incorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 second)listMirrorMaker is not available, please make sure MirrorMakerAgent is running.



Expand
titleList All Mirror Maker

POST /mirrormakers/listall

This API returns all the MirrorMakers and their present status.

Required AAF Permissions: org.onap.dmaap.mr.mirrormaker|*|admin

Request:

Request Payload:

Parameter NameReq'dDescription
listAllMirrorMakerYAn empty listAllMirrorMaker JSON object


{

    "listAllMirrorMaker":

        {

        }

}

Response Payload:

{
"listMirrorMaker": [
{
"name": "centraltoedge",
"producer": "10.12.5.108:30491",
"whitelist": "org.onap.dmaap.mr.mrtesttopic",
"enablelogCheck": true,
"consumer": "10.12.6.98:30491",
"status": "RUNNING",
"numStreams": 3
}
],
"messageID": "99310"
}

Error Messages:

Error ReasonError Message
No AAF Mirror Maker Admin permissionNo Mirror Maker Admin permission.
Incorrect payloadThis is not a ListAllMirrorMaker request. Please try again.
Incorrect JSONIncorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 second)listMirrorMaker is not available, please make sure MirrorMakerAgent is running



Expand
titleDelete Mirror Maker

POST /mirrormakers/delete

This API is used to delete an existing MirrorMaker. 

Required AAF Permissions: org.onap.dmaap.mr.mirrormaker|*|admin

Request:

Request Payload:

Parameter NameReq'dDescription
deleteMirrorMakerYMirror Maker Request Object
NameYExisting MirrorMaker name

{
"deleteMirrorMaker":
{
"name":"centraltoedge2"
}
}


Response Payload:


"listMirrorMaker": [
{
"name": "centraltoedge",
"producer": "10.12.5.108:30491",
"whitelist": "org.onap.dmaap.mr.mrtesttopic",
"enablelogCheck": true,
"consumer": "10.12.6.98:30491",
"status": "RUNNING",
"numStreams": 3
}
],
"messageID": "99310"
}


Error Messages:

Error ReasonError Message
No AAF Mirror Maker Admin permissionNo Mirror Maker Admin permission.
Incorrect MirrorMaker name that does not exist MirrorMaker <MM Name> does not exist
Incorrect payloadThis is not a DeleteMirrorMaker request. Please try again.
Incorrect JSONIncorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 second)listMirrorMaker is not available, please make sure MirrorMakerAgent is running.



WhiteList


Expand
titleCreate Whitelist

POST /mirrormakers/createwhitelist

This API is used to add a new topic  to the whitelist.

AAF permissions required: org.onap.dmaap.mr.mirrormaker|*|user ,  org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:org.onap.dmaap.mr|create

Request Payload:

Parameter NameReq'dDescription
nameYMirror Maker name
namespaceYa namespace
whitelistTopicNameYa topic name that contains only alpha numeric value

{
"name":"centraltoedge",
"namespace":"org.onap.dmaap.mr",
"whitelistTopicName":"org.onap.dmaap.mr.mrtesttopic2"
}


Response Payload:

{
"listMirrorMaker": [
{
"name": "centraltoedge",
"producer": "10.12.5.108:30491",
"whitelist": "org.onap.dmaap.mr.mrtesttopic,org.onap.dmaap.mr.mrtesttopic2",
"enablelogCheck": true,
"consumer": "10.12.6.98:30491",
"status": "RESTARTING",
"numStreams": 3
}
],
}


Error Messages:

Error ReasonError Message
No AAF Mirror Maker User permissionNo Mirror Maker User permission.
No AAF Mirror Maker User Create permission (User should have create topics permission ont he namespace listed)No Mirror Maker User Create permission.
Incorrect JSONIncorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
Request contain topic that already existThe topic already exist.
If the namespace in the topic does not match with the namespace in the requestThe namespace of the topic does not match with the namespace you provided.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 second)listWhiteList is not available, please make sure MirrorMakerAgent is running
Incorrect payloadThis is not a createWhitelist request. Please try again.



Expand
titleList All WhiteList

POST /mirrormakers/listallwhitelist

This API  list all the Whitelists .

AAF permissions required: org.onap.dmaap.mr.mirrormaker|*|user , org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:org.onap.dmaap.mr|create

Request Payload:

Parameter NameReq'dDescription
nameYMirror Maker name
namespaceYa namespace


{
"name":"centraltoedge",
"namespace":"org.onap.dmaap.mr"
}

Response Payload:

"name": "centraltoedge",
"whitelist": "org.onap.dmaap.mr.mrtesttopic,org.onap.dmaap.mr.mrtesttopic2"
}

Error Messages:

Error ReasonError Message
No AAF Mirror Maker User permissionNo Mirror Maker User permission.
No AAF Mirror Maker User Create permissionNo Mirror Maker User Create permission.
Incorrect JSONIncorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 second)listallWhiteList is not available, please make sure MirrorMakerAgent is running
Incorrect payloadThis is not a ListAllWhitelist request. Please try again.



Expand
titleDelete Whitelist

POST /mirrormakers/deletewhitelist

This API removes a topic from whitelist.

AAF permissions required: org.onap.dmaap.mr.mirrormaker|*|user , org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:org.onap.dmaap.mr|create

Request Payload:

Parameter NameReq'dDescription
nameYMirror Maker name
namespaceYa namespace
whitelistTopicNameYa topic name that contains only alpha numeric value


{
"name":"centraltoedge",
"namespace":"org.onap.dmaap.mr",
"whitelistTopicName":"org.onap.dmaap.mr.mrtesttopic2"
}

Response Payload:

{
"listMirrorMaker": [
{
"name": "centraltoedge",
"producer": "10.12.5.108:30491",
"whitelist": "org.onap.dmaap.mr.mrtesttopic",
"enablelogCheck": true,
"consumer": "10.12.6.98:30491",
"status": "RESTARTING",
"numStreams": 3
}
],
}


Error Messages:

Error ReasonError Message
No AAF Mirror Maker User permissionNo Mirror Maker User permission.
No AAF Mirror Maker User Create permissionNo Mirror Maker User Create permission.
Incorrect JSONIncorrect JSON object.Could not parse JSON. Please correct the JSON format and try again.
Request contain topic does not existThe topic does not exist.
If Mirror Maker agent is down or it takes more than (right now it is configured 15 second)listWhiteList is not available, please make sure MirrorMakerAgent is running
Incorrect payloadThis is not a DeleteAllWhitelist request. Please try again.



Recommendations:

1) Topic partitions must be same in both producer and consumer Kafka clusters

2) For better performance numStreams should match  to the topic  partitions