-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


Apache CloudStack . Apache Kafka

, 23 2017 . 13:02 +


Apache CloudStack (ACS) Apache Kafka.


. , , , - . , , , , :



, API, , , API.


ACS :


  1. API ACS .
  2. API API, .
  3. ACS, .

, ACS . . , , :


  • , (SMS, IM) , , ;
  • (, , );
  • ACS.

, , API. , , .

ACS AMPQ RabbitMQ Apache Kafka Apache Kafka, . Apache Kafka, ACS .


VS API


API . , , API (, REST ). :


  1. ;
  2. ;
  3. .

. , , SMS . :


  1. ;
  2. - .

, , , , .


, , ( ), , , , API , , , .


. , Apache Kafka c , , , .


ACS Apache Kafka


Apache Kafka "" . . , Kafka ACS .


Kafka Docker- spotify/kafka, (Apache Zookeeper Kafka) .


Docker ( CentOS 7) :


# yum install -y yum-utils device-mapper-persistent-data lvm2
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# yum makecache fast
# yum install docker-ce

Apache Kafka


Apache Kafka:


# docker run -d -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=10.0.0.66 --env ADVERTISED_PORT=9092 spotify/kafka
c660741b512a

, Kafka 10.0.0.66:9092, Apache Zookeeper 10.0.0.66:2181.
Kafka Zookeeper :


"cs" "test":


# docker exec -i -t c660741b512a bash -c "echo 'test' | /opt/kafka_2.11-0.10.1.0/bin/kafka-console-producer.sh --broker-list 10.0.0.66:9092 --topic cs"
[2017-07-23 08:48:11,222] WARN Error while fetching metadata with correlation id 0 : {cs=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)

:


# docker exec -i -t c660741b512a /opt/kafka_2.11-0.10.1.0/bin/kafka-console-consumer.sh --bootstrap-server=10.0.0.66:9092 --topic cs --offset=earliest --partition=0
test
^CProcessed a total of 1 messages

, , Kafka .


Apache CloudStack


ACS ( ). (/etc/cloudstack/management/kafka.producer.properties) Kafka, ACS :


bootstrap.servers=10.0.0.66:9092
acks=all
topic=cs
retries=1

Kafka .


Kafka bootstrap.servers .

java bean, Kafka:


# mkdir -p /etc/cloudstack/management/META-INF/cloudstack/core

bean-a (/etc/cloudstack/management/META-INF/cloudstack/core/spring-event-bus-context.xml) :



   
     
   

ACS:


# systemctl restart cloudstack-management

cs, JSON, ( ):


{
 "Role":"e767a39b-6b93-11e7-81e3-06565200012c",
 "Account":"54d5f55c-5311-48db-bbb8-c44c5175cb2a",
 "eventDateTime":"2017-07-23 14:09:08 +0700",
 "entityuuid":"54d5f55c-5311-48db-bbb8-c44c5175cb2a",
 "description":"Successfully completed creating Account. Account Name: null, Domain Id:1",
 "event":"ACCOUNT.CREATE",
 "Domain":"8a90b067-6b93-11e7-81e3-06565200012c",
 "user":"f484a624-6b93-11e7-81e3-06565200012c",
 "account":"f4849ae2-6b93-11e7-81e3-06565200012c",
 "entity":"com.cloud.user.Account","status":"Completed"
}

{
 "Role":"e767a39b-6b93-11e7-81e3-06565200012c",
 "Account":"54d5f55c-5311-48db-bbb8-c44c5175cb2a",
 "eventDateTime":"2017-07-23 14:09:08 +0700",
 "entityuuid":"4de64270-7bd7-4932-811a-c7ca7916cd2d",
 "description":"Successfully completed creating User. Account Name: null, DomainId:1",
 "event":"USER.CREATE",
 "Domain":"8a90b067-6b93-11e7-81e3-06565200012c",
 "user":"f484a624-6b93-11e7-81e3-06565200012c",
 "account":"f4849ae2-6b93-11e7-81e3-06565200012c",
 "entity":"com.cloud.user.User","status":"Completed"
}

{
 "eventDateTime":"2017-07-23 14:14:13 +0700",
 "entityuuid":"0f8ffffa-ae04-4d03-902a-d80ef0223b7b",
 "description":"Successfully completed creating User. UserName: test2, FirstName :test2, LastName: test2",
 "event":"USER.CREATE",
 "Domain":"8a90b067-6b93-11e7-81e3-06565200012c",
 "user":"f484a624-6b93-11e7-81e3-06565200012c",
 "account":"f4849ae2-6b93-11e7-81e3-06565200012c",
 "entity":"com.cloud.user.User","status":"Completed"
}

, . Kafka :


# docker exec -i -t c660741b512a \
    /opt/kafka_2.11-0.10.1.0/bin/kafka-console-consumer.sh --bootstrap-server=10.0.0.66:9092 --topic cs --offset=earliest --partition=0

, , Apache Kafka. 15-20 .


"" :


  1. ACS;
  2. Kafka (, 3 x3);
  3. Apache Zookeeper (, 3 );
  4. /etc/cloudstack/management/kafka.producer.properties .
  5. Kafka (, 1 ).


, , , " ", , :


  1. ACS , , , .
  2. ACS 4.9.2, , .
  3. , .
  4. Openstack , , , , . , .

, .

Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/333928/


: [1] []
 

:
: 

: ( )

:

  URL