Kafka-manager

github : https://github.com/yahoo/kafka-manager

2018년 8월 현재 kafka 1.1.0 버전 까지 지원한다.


kafka 매니저는 yahoo에서 개발한 kafka 관리 도구이며 아래의 기능을 제공한다.

  • 다수의 클러스터 관리
  • 간단하게 클러스터 상태 조회 가능(topics, consumers, offsets, brokers, replica distribution, partition distribution)
  • Preferred replica election 실행
  • 사용할 브로커 선택 옵션을 사용하여 파티션 할당 생성

  • 파티션 재할당 (based on generated assignments)
  • 토픽 생성시 옵션 설정 가능(0.8.1.1 has different configs than 0.8.2+)
  • 토픽 삭제(버전 0.8.2 이상, delete.topic.enable=true 설정시)
  • 삭제표시된 토픽리스트 조회 (only supported on 0.8.2+)
  • 다수의 토픽에 일괄 파티션생성 및 사용할 브로커 할당
  • 다수의 토픽에 파티션 재할당 일괄 실행
  • 기존 토픽에 파티션 추가.
  • 기존 토픽 설정 업데이트
  • (Optional) enable JMX polling for broker level and topic level metrics.
  • (Optional) filter out consumers that do not have ids/ owners/ & offsets/ directories in zookeeper.

설치

SBT(simple build tool) 설치

  • windows
  • CentOS
    참고페이지
    아래 커맨드를 이용해 repo 파일을 받고, yum을 이용해 설치

    $ curl https://bintray.com/sbt/rpm/rpm sudo tee /etc/yum.repos.d/bintray-sbt-rpm.repo
    sudo yum install sbt

Kafka-manager 설치

  1. 파일 다운로드 : 다운로드페이지에서 압축파일(zip or tar.gz)을 다운로드.
  2. 압축해재 후 sbt를 이용해 배포

    C:\dev\kafka-manager>sbt clean dist
     실행 결과

    `sbt run` 명령어를 입력해 실행 가능. 또는 \target\universal 경로에 생성되는 zip 파일을  원하는 경로에 압축 해제

kafka-manager 설정변경

압축 해제한 경로로 이동하여 설정파일을 수정해야 한다.

  • 주키퍼 호스트 설정 : conf/application.conf 파일 수정

    conf/application.conf
    #zookeeper 서버가 한 대인 경우
    $ kafka-manager.zkhosts="localhost:2181" #사용하는 zookeeper 정보에 맞춰 수정
     
     
    #zookeeper 서버가 다수인 경우
    $ kafka-manager.zkhosts="my.zookeeper.host.com:2181,other.zookeeper.host.com:2181" #쉼표를 이용해 다수의 주키퍼 호스트 입력가능

    더 자세한 내용은 https://github.com/yahoo/kafka-manager#configuration 참조

  • JMX port 설정
    kafka-manager에서 metric 정보를 확인하고자 하면 jmx를 활성화 해 주어야 한다. 
    `bin/kafka-server-start.sh` 파일을 열어 JMX 포트 설정을 추가한 뒤 kafka를 재기동 해준다.

    ${KAFKA_HOME}/bin/kafka-server-start.sh
    export JMX_PORT=9999


    Kafka Manager UI에 접속해 Clusters메뉴에서 modify 버튼은 클릭해 JMX 사용옵션을 활성화 한다.


kafka-manager 구동

압축 해제한 경로로 이동해 프로그램을 실행한다.

$ bin/kafka-manager


기본적으로 9000번 포트를 사용하며 실행시 아래 옵션을 통해 설정파일의 위치를 지정하거나 포트를 설정할 수 있다.

$ bin/kafka-manager -Dconfig.file=/path/to/application.conf -Dhttp.port=8080


'spark,kafka,hadoop ecosystems > apache.kafka' 카테고리의 다른 글

kafka - partitions  (0) 2018.11.20
kafka log 정책  (0) 2018.11.20
kafka tuning config  (0) 2018.11.20
kafka multi brokers  (0) 2018.11.20
kafka connect  (0) 2018.11.20

Usually, you don't need to modify these settings, however, if you want to extract every last bit of performance from your machines, then changing some of them can help. You may have to tweak some of the values, but these worked 80% of the cases for me:

  • message.max.bytes=1000000
  • num.network.threads=3
  • num.io.threads=8
  • background.threads=10
  • queued.max.requests=500
  • socket.send.buffer.bytes=102400
  • socket.receive.buffer.bytes=102400
  • socket.request.max.bytes=104857600
  • num.partitions=1

Quick explanations of the numbers:

  • message.max.bytes: This sets the maximum size of the message that the server can receive. This should be set to prevent any producer from inadvertently sending extra large messages and swamping the consumers. The default size is 1000000.
  • num.network.threads: This sets the number of threads running to handle the network's request. If you are going to have too many requests coming in, then you need to change this value. Else, you are good to go. Its default value is 3.
  • num.io.threads: This sets the number of threads spawned for IO operations. This is should be set to the number of disks present at the least. Its default value is 8.
  • background.threads: This sets the number of threads that will be running and doing various background jobs. These include deleting old log files. Its default value is 10 and you might not need to change it.
  • queued.max.requests: This sets the queue size that holds the pending messages while others are being processed by the IO threads. If the queue is full, the network threads will stop accepting any more messages. If you have erratic loads in your application, you need to set queued.max.requests to a value at which it will not throttle.
  • socket.send.buffer.bytes: This sets the SO_SNDBUFF buffer size, which is used for socket connections.
  • socket.receive.buffer.bytes: This sets the SO_RCVBUFF buffer size, which is used for socket connections.
  • socket.request.max.bytes: This sets the maximum size of the request that the server can receive. This should be smaller than the Java heap size you have set.
  • num.partitions: This sets the number of default partitions of a topic you create without explicitly giving any partition size.

Number of partitions may have to be higher than 1 for reliability, but for performance (even not realistic :)), 1 is better.

These are no silver bullet :), however, you could test these changes with a test topic and 1,000/10,000/100,000 messages per second to see the difference between default values and adjusted values. Vary some of them to see the difference.

You may need to configure your Java installation for maximum performance. This includes the settings for heap, socket size, and so on.

'spark,kafka,hadoop ecosystems > apache.kafka' 카테고리의 다른 글

kafka log 정책  (0) 2018.11.20
kafka manager  (0) 2018.11.20
kafka multi brokers  (0) 2018.11.20
kafka connect  (0) 2018.11.20
kafka vs flink vs esper vs storm vs spark  (0) 2018.11.20

Ambari 환경에서 multi broker 를 넣는 방법은 두가지가있다.


1. 단순히 아래블로그를 참고하여 server 를 개별로 실행 시키는 방법

 여기를 클릭하여 펼치기...

2. Amabari 를 통해서 Kafka multi broker 를 구현

https://community.hortonworks.com/articles/90895/how-to-configure-multiple-listeners-in-kafka.html
위 페이지를 참고하여 PLAINTEXTSASL (새로운프로토콜) 사용하여 브로커추가를 할 수있다.
또한 https://docs.confluent.io/3.1.2/kafka/sasl.html 을 참고하여 프로토콜 설정을 amabari-kafka-JAAS  설정 파일에 하게되면 되는데,
1개의 카프카서버 - 1 개의 프로토콜로  여러개의  브로커를 둘수 없는 듯하다.

2번방식은결국 프로토콜을 늘려서 브로커를 늘리는 방식이고 개수의 한계가 있다.

결국 정리하자면 복수개의 브로커를 두려면 1번 방식으로 여러번 실행 시켜야 한다. 다만 암바리가 그런환경을 공식적으로 지원하지 않는 듯 하다.

왜? 필요가 없으니까 (kafka 는 대체로 1브로커 체재에서도 바쁘다)


'spark,kafka,hadoop ecosystems > apache.kafka' 카테고리의 다른 글

kafka manager  (0) 2018.11.20
kafka tuning config  (0) 2018.11.20
kafka connect  (0) 2018.11.20
kafka vs flink vs esper vs storm vs spark  (0) 2018.11.20
kafka-개요  (0) 2018.11.20

+ Recent posts