{"id":475206,"date":"2026-01-16T09:12:28","date_gmt":"2026-01-16T09:12:28","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=475206"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=475206","title":{"rendered":"\u0423\u0434\u043e\u0431\u043d\u0430\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a Kafka"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2e4\/7cf\/760\/2e47cf760a74729ab0e484346ce2eb0b.png\" width=\"1920\" height=\"1080\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2e4\/7cf\/760\/2e47cf760a74729ab0e484346ce2eb0b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2e4\/7cf\/760\/2e47cf760a74729ab0e484346ce2eb0b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kafka, \u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e\u00a0\u0432\u00a0\u043d\u0435\u043c \u0435\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f\u00a0\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0430\u00a0\u0435\u0441\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430.<\/p>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0441\u0432\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432. <\/p>\n<p>\u041f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u043c \u0431\u0440\u043e\u043a\u0435\u0440\u0435\u00a0\u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u0435\u0437\u0434\u0435.<\/p>\n<p>Bourne again shell. \u041f\u043e\u0433\u043d\u0430\u043b\u0438!<\/p>\n<p>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u00a0\u043f\u043e\u043c\u043e\u0449\u0438 <strong>rsync+ssh<\/strong>. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u00a0\u0443\u0437\u043b\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u00a0\u0442\u0435\u043c\u00a0\u0436\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u043f\u043e\u0434\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u041f\u041e\u00a0Kafka.<\/p>\n<p>\u041d\u043e\u00a0\u043f\u0435\u0440\u0435\u0434 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <strong>server.properties<\/strong> \u043d\u0430\u00a0\u0434\u0432\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u00a0\u2014 <strong>server.properties.uniq<\/strong> \u0438 <strong>server.properties.common<\/strong>.<\/p>\n<p><strong>server.properties.uniq <\/strong>\u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0440\u043e\u043a\u0435\u0440\u0430. <\/p>\n<p><strong>server.properties.common <\/strong>\u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0440\u043e\u043a\u0435\u0440\u0430.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u00a0\u0447\u0438\u0442\u0430\u0442\u044c, \u0442\u0430\u043c \u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u00a0\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0437\u0430\u043c\u0435\u0442\u043a\u0438, \u044f \u0435\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u00a0\u0441\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>server.properties<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">############################# Server Basics ############################## The id of the broker. This must be set to a unique integer for each broker.broker.id=1broker.rack=DC1advertised.listeners=SASL_SSL:\/\/yamaha1.bercut.com:9093advertised.host.name=yamaha1.bercut.comlisteners=SASL_SSL:\/\/yamaha1.bercut.com:9093#Kerberoslistener.name.sasl_ssl.gssapi.sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true \\                              keyTab=\"\/opt\/kafka-secret\/kafka-server-yamaha1.keytab\" principal=\"KAFKA\/yamaha1.bercut.com\";############################# End of Server Basics ################################################### Zookeeper #################################zookeeper.connection.timeout.ms=18000zookeeper.connect=yamaha1.bercut.com:2182,yamaha2.bercut.com:2182,yamaha3.bercut.com:2182## Properties for SSL Zookeeper Security between Zookeeper and Brokerzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNettyzookeeper.ssl.client.enable=truezookeeper.ssl.protocol=TLSv1.2zookeeper.ssl.truststore.location=\/opt\/kafka-config\/ssl\/kafka\/zookeeper-client.truststore.jkszookeeper.ssl.truststore.password=ChangeThisZKeySecretzookeeper.ssl.keystore.location=\/opt\/kafka-config\/ssl\/kafka\/zookeeper-client.keystore.jkszookeeper.ssl.keystore.password=ChangeThisZKeySecretzookeeper.set.acl=true############################ SSL and SASL settings ############################### put this line if your certificate does not contain FQDN#ssl.endpoint.identification.algorithm=ssl.keystore.location=\/opt\/kafka-config\/ssl\/kafka\/kafka.server.keystore.jksssl.keystore.password=ChangeThisKKeySecretssl.key.password=ChangeThisKKeySecretssl.truststore.location=\/opt\/kafka-config\/ssl\/kafka\/kafka.server.truststore.jksssl.truststore.password=ChangeThisKKeySecretssl.protocol=TLSv1.2security.inter.broker.protocol=SASL_SSL##ssl.client.auth=requiredssl.client.auth=none##Properties for SASL beetween the brokers and clients#sasl.enabled.mechanisms=SCRAM-SHA-512sasl.enabled.mechanisms=SCRAM-SHA-512,GSSAPIsasl.kerberos.service.name=kafkasasl.mechanism.inter.broker.protocol=SCRAM-SHA-512listener.name.sasl_ssl.scram-sha-512.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=\"broker-admin\" password=\"ChangeThisAdminSecret\";super.users=User:broker-admin##Properties for Authorizationauthorizer.class.name=kafka.security.authorizer.AclAuthorizer# disable this for more security allow.everyone.if.no.acl.found=false############################# Socket Server Settings ############################## Maps listener names to security protocols, the default is for them to be the same. # See the config documentation for more details#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL# The number of threads that the server uses for receiving requests from the network and sending responses to the networknum.network.threads=8# The number of threads that the server uses for processing requests, which may include disk I\/Onum.io.threads=16# The send buffer (SO_SNDBUF) used by the socket serversocket.send.buffer.bytes=102400# The receive buffer (SO_RCVBUF) used by the socket serversocket.receive.buffer.bytes=102400# The maximum size of a request that the socket server will accept (protection against OOM)socket.request.max.bytes=104857600############################# Log Basics ############################## A comma separated list of directories under which to store log fileslog.dirs=\/data\/kafka-logs# The default number of log partitions per topic. More partitions allow greater# parallelism for consumption, but this will also result in more files across# the brokers.num.partitions=2# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.# This value is recommended to be increased for installations with data dirs located in RAID array.num.recovery.threads.per.data.dir=2############################# Internal Topic Settings  ############################## The replication factor for the group metadata internal topics \"__consumer_offsets\" and \"__transaction_state\"# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.offsets.topic.replication.factor=3transaction.state.log.replication.factor=3transaction.state.log.min.isr=2offsets.topic.min.isr=2############################# Log Flush Policy ############################## Messages are immediately written to the filesystem but by default we only fsync() to sync# the OS cache lazily. The following configurations control the flush of data to disk.# There are a few important trade-offs here:#    1. Durability: Unflushed data may be lost if you are not using replication.#    2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.#    3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.# The settings below allow one to configure the flush policy to flush data after a period of time or# every N messages (or both). This can be done globally and overridden on a per-topic basis.# The number of messages to accept before forcing a flush of data to disklog.flush.interval.messages=10000# The maximum amount of time a message can sit in a log before we force a flushlog.flush.interval.ms=1000############################# Log Retention Policy ############################## The following configurations control the disposal of log segments. The policy can# be set to delete segments after a period of time, or after a given size has accumulated.# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens# from the end of the log.# The minimum age of a log file to be eligible for deletion due to age#7 days#log.retention.hours=168#4 dayslog.retention.ms=345600000# A size-based retention policy for logs. Segments are pruned from the log unless the remaining# segments drop below log.retention.bytes. Functions independently of log.retention.hours.#1GBlog.retention.bytes=1073741824# The maximum size of a log segment file. When this size is reached a new log segment will be created#1GBlog.segment.bytes=1073741824# The interval at which log segments are checked to see if they can be deleted according# to the retention policies#5minlog.retention.check.interval.ms=300000############################# Group Coordinator Settings ############################## The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.# The default value for this is 3 seconds.# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.group.initial.rebalance.delay.ms=3000############################# General Topics Settings #############################delete.topic.enable=falseauto.create.topics.enable=falseconfig.storage.replication.factor=3replica.lag.time.max.ms=2000replica.fetch.wait.max.ms=200min.insync.replicas=2default.replication.factor=3unclean.leader.election.enable = falsenum.replica.fetchers=2############################ consumer local read connections priority ###################replica.selector.class=org.apache.kafka.common.replica.RackAwareReplicaSelector<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u0430 \u0441\u0435\u043a\u0446\u0438\u044f &#171;<strong>Server Basics<\/strong>&#187; \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0432 <strong>server.properties.uniq<\/strong>.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043f\u043b\u0438\u0442. \u041f\u0435\u0440\u0435\u0434 \u0441\u043f\u043b\u0438\u0442\u043e\u043c \u043d\u0430\u00a0\u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. \u041f\u0438\u0448\u0435\u043c <strong>splitcfg.sh<\/strong>.<\/p>\n<pre><code class=\"bash\">#!\/bin\/bashcfg=\"server.properties\"mydir=$(dirname \"$0\")cd \"${mydir}\"umask 026if [[ -f \"${cfg}.uniq\" ]]; then                 echo Saving old ${cfg}.uniq to ${cfg}.uniq.bak                mv ${cfg}.uniq ${cfg}.uniq.bakfiif [[ -f \"${cfg}.common\" ]]; then                echo Saving old ${cfg}.common to ${cfg}.common.bak                mv ${cfg}.common ${cfg}.common.bak fiuniqtxt=falsewhile read line; do        if [[ \"$line\" == \"############################# Server Basics #############################\" ]]; then                uniqtxt=true        fi        if [[ \"$uniqtxt\" == \"true\" ]]; then                echo \"$line\" &gt;&gt; ${cfg}.uniq        else                echo \"$line\" &gt;&gt; ${cfg}.common        fi        if [[ \"$line\" == \"############################# End of Server Basics ######################\" ]]; then                uniqtxt=false        fidone &lt; &lt;(cat \"${cfg}\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, <strong>splitcfg.sh<\/strong> \u0433\u043e\u0442\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e (<strong>mergecfg.sh<\/strong>):<\/p>\n<pre><code class=\"bash\">#!\/bin\/bashcfg=\"server.properties\"mydir=$(dirname \"$0\")cd \"${mydir}\"umask 026cat ${cfg}.uniq ${cfg}.common &gt; $cfg<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>splitcfg.sh<\/strong> \u0438 <strong>mergecfg.sh <\/strong>\u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0432\u0441\u0435 \u0431\u0440\u043e\u043a\u0435\u0440\u044b.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u0443\u044e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u0430\u043c\u0438. <\/p>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e \u043a\u043e\u0434\u0443:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash# \u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432. # \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u0430\u043c \u043f\u043e\u0439\u043c\u0435\u0442, \u0441 \u043a\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e, \u0430 \u0441 \u043a\u0435\u043c \u043d\u0435\u0442 (\u0441 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435 \u043d\u0430\u0434\u043e).CLUSTER_HOSTS=(10.1.1.1 10.1.1.2 10.1.1.3)# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e rsync+sshkafkauser=\"kafka\"# \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b kafka \u043b\u0435\u0436\u0430\u0442 \u043f\u043e \u043f\u0443\u0442\u0438  \/opt\/kafka_\u0432\u0435\u0440\u0441\u0438\u044f, # \u0430 \u0441\u0438\u043c\u043b\u0438\u043d\u043a \/opt\/kafka \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043d\u0435\u0433\u043e (\u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u0438).# \u041e\u0431\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u043f\u0430\u043f\u043a\u0438 kafka.kafkadir=\"$(readlink -f \/opt\/kafka)\"# SSH \u043a\u043b\u044e\u0447, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e rsync+sshssh_key=\"\/home\/${kafkauser}\/.ssh\/id_ed25519\"# \u0412\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.tmp_dir=\"\/tmp\/kafka-sync\"# \u0424\u043b\u0430\u0436\u043e\u043a \u0438\u043d\u0442\u0435\u0440\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438. \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c# \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0444\u0430\u0439\u043b\u043e\u0432.interactive=\"true\"# \u0421\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043f\u043e\u043a \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438.file_list=\"\/opt\/jmx_prometheus_javaagent\/opt\/kafka\/opt\/kafka-config${kafkadir}\/bin${kafkadir}\/config${kafkadir}\/libs${kafkadir}\/LICENSE${kafkadir}\/licenses${kafkadir}\/NOTICE${kafkadir}\/site-docs\"# \u0421\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. # \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432 Kafka# \u0438 \u0443\u0437\u043b\u043e\u0432 Zookeeper.# \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c server.properties, server.properties.uniq \u0438 \u0435\u0433\u043e \u0431\u044d\u043a\u0430\u043f.exclude_file_list=\"${kafkadir}\/logs\/*\/opt\/kafka-config\/ssl\/opt\/kafka-config\/ssl\/zookeeper\/opt\/kafka-config\/ssl\/kafka\/opt\/kafka-config\/server.properties.uniq\/opt\/kafka-config\/server.properties\/opt\/kafka-config\/server.properties.uniq.bak \"# \u041f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c '--exclude=', # \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 rsync.exclude_file_list=$(echo \"${exclude_file_list}\" | sed 's|^| --exclude=|g')# \u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0438 \u043e\u0431\u0449\u0443\u044e (splitcfg.sh \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432\u044b\u0448\u0435).echo \"Spliting server.properties\"\/opt\/kafka-config\/splitcfg.sh# \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 IP \u0430\u0434\u0440\u0435\u0441, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u043e\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 # HOSTS_TO_SYNC, \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0432 \u043d\u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f.my_ip=$(\/sbin\/ip add | sed -n '\/127.0.0.1\/d; s\/.*inet \\([0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\).*\/\\1\/p;')for host in ${CLUSTER_HOSTS[@]}; do          [[ \"$host\" == \"$my_ip\" ]] &amp;&amp; continue            HOSTS_TO_SYNC+=(\"${host}\")    done# \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e remote_host \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 HOSTS_TO_SYNCfor remote_host in ${HOSTS_TO_SYNC[@]}; do   # \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 dry-run (\u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439) \u0438\u0449\u0435\u043c \u0444\u0430\u0439\u043b\u044b,    # \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043e\u0442 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.   echo \"Sync with ${remote_host}.\"   echo -n \"Scanning difference of files... \"   diff_files=$(   rsync --recursive \\         --relative \\         --itemize-changes  \\         --dry-run \\         --delete \\         --links \\         --checksum \\         --group --owner --perms --no-times \\         -e \"ssh -i ${ssh_key}\" \\         ${exclude_file_list} \\         ${file_list} \\         ${kafkauser}@${remote_host}:\/   )   echo -e \"Done\\n#######################################\"   # \u0415\u0441\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f, \u0442\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430,    # \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0439\u0434\u0435\u043d\u044b\u0445 \u043e\u0442\u043b\u0438\u0447\u0438\u0439.   if [ -n \"$(echo ${diff_files})\" ] ; then      echo \"       Description for string [&lt;&gt;][fd]cstpoguax:        &lt;     transferred to the remote host.             c     different checksum        &gt;     received to the local host.                 s     different size         .     the item is not being updated               T     modification time will be  set to the transfer time        f     file                                        p     different permissions         d     directory                                   o     different owner         L     symlink                                     g     different group                                                          a     ACL information changed                                                          x     the extended attribute information changed\"      echo -e \"#######################################\\n\\nList of file differences\\n\"        # \u0421\u043f\u0438\u0441\u043e\u043a \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0444\u0430\u0439\u043b\u043e\u0432      echo \"${diff_files}\" | sed '\/^$\/d'      # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443       # \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f.      echo -en \"\\n#######################################\\nMaking cache of remote files to compare. \"      remote_file_list=$(echo \"${diff_files}\" | awk '{print $2}' | sed '\/^ *$\/d; \/\\\/bin\/d; s\/^\/'${kafkauser}@${remote_host}:'\/')      echo -e \"Downloading files to ${tmp_dir}:\\n${remote_file_list}\\n\"      mkdir -p ${tmp_dir}       rsync -e \"ssh -i ${ssh_key}\" \\            --recursive \\            --relative \\            --links \\            $remote_file_list \\            ${tmp_dir} 2&gt;\/dev\/null      echo -e \"\\nDone\\n#######################################\"  # \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u0445 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430      while read line; do           echo -e \"\\n\\nComparing file\\n${line}\\n\\n\"           rfile=$(echo $line | awk '{print $2}')           echo \"diff ${remote_host}:${rfile} ${rfile}\"           diff ${tmp_dir}\/${rfile} ${rfile}           echo -e \"\\n\\n#######################################\\n\\n\"      done &lt; &lt;(echo \"${diff_files}\")      # \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443      echo \"Removing Local ${tmp_dir}\"      rm -r ${tmp_dir}  # \u0415\u0441\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0444\u043b\u0430\u0433 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430,       # \u043f\u043e\u043a\u0430 \u043e\u043d \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442 \u0438\u0445 \u0432\u0432\u0435\u0434\u044f \"y\".      # \u0414\u043b\u044f \u043e\u0442\u043a\u0430\u0437\u0430 - \"n\" \u0438\u043b\u0438 \"Ctrl\" + \"C\".      if [ \"${interactive}\" == \"true\" ]; then          while : ; do              echo -e \"\\nDo you wish sync changes?\"               read LINE              echo \"User answer ${LINE}\"               [ \"${LINE}\" == \"y\" ] &amp;&amp; break              [ \"${LINE}\" == \"n\" ] &amp;&amp; exit 1          done      fi  # \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0440\u043e\u043a\u0435\u0440\u0430      echo \"Building remote server.properties.uniq ... \"      ssh -i ${ssh_key} ${kafkauser}@${remote_host} \"                 \/opt\/kafka-config\/splitcfg.sh                  \" &amp;&amp; echo \"Done\"        # \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u043c      echo \"Sync with ${remote_host}... \"      rsync --recursive \\            --relative \\            --links \\            --delete \\            --checksum \\            --group --owner --perms --no-times \\            -e \"ssh -i ${ssh_key}\" \\            ${exclude_file_list} \\            ${file_list} \\            ${kafkauser}@${remote_host}:\/ \\      &amp;&amp; echo \"Done\"      # \u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0431\u043e\u0440\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 server.properties \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435      echo \"Building remote server.properties ... \"      ssh -i ${ssh_key} ${kafkauser}@${remote_host} \"                 \/opt\/kafka-config\/mergecfg.sh                  \" &amp;&amp; echo \"Done\"   else      echo -e \"\\n(No changes found)\\n\"   fidone<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u0438 \u0443\u0437\u043b\u0430 Zookeeper, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0438\u0445 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432 \u0438 Zookeeper \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u00a0\u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u00a0\u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f\u0445, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043a\u00a0\u0431\u0440\u043e\u043a\u0435\u0440\u0430\u043c, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043e\u043a \u0432\u00a0\u043a\u043e\u043d\u0441\u044c\u044e\u043c\u0435\u0440\u2011\u0433\u0440\u0443\u043f\u043f\u0430\u0445.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0432\u00a0\u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u00a0\u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0437\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u044f \u0432\u00a0\u043b\u043e\u0433\u0438, \u0432\u0441\u0435\u2011\u0442\u0430\u043a\u0438 \u043f\u0440\u043e\u0434. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043b\u044f\u00a0\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0430\u00a0\u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u00a0\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u00a0\u2014 \u0435\u0441\u043b\u0438 \u043e\u0434\u0438\u043d \u0431\u0440\u043e\u043a\u0435\u0440 \u043d\u0430\u0447\u0430\u043b \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u00a0\u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0435, \u0442\u043e \u044d\u0442\u043e \u043f\u043e\u0432\u043e\u0434 \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u0437\u0430\u0434.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/947378\/\">https:\/\/habr.com\/ru\/articles\/947378\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0443\u0437\u043b\u043e\u0432\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kafka, \u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e\u00a0\u0432\u00a0\u043d\u0435\u043c \u0435\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f\u00a0\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0430\u00a0\u0435\u0441\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430.\u0412\u00a0\u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u0441\u0432\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432. \u041f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0430\u00a0\u043e\u0434\u043d\u043e\u043c \u0431\u0440\u043e\u043a\u0435\u0440\u0435\u00a0\u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u0435\u0437\u0434\u0435.Bourne again shell. \u041f\u043e\u0433\u043d\u0430\u043b\u0438!\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u00a0\u043f\u043e\u043c\u043e\u0449\u0438 rsync+ssh. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u00a0\u0443\u0437\u043b\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u00a0\u0442\u0435\u043c\u00a0\u0436\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u043f\u043e\u0434\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u041f\u041e\u00a0Kafka.\u041d\u043e\u00a0\u043f\u0435\u0440\u0435\u0434 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b server.properties \u043d\u0430\u00a0\u0434\u0432\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u00a0\u2014 server.properties.uniq \u0438 server.properties.common.server.properties.uniq \u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0440\u043e\u043a\u0435\u0440\u0430. server.properties.common \u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0431\u0449\u0438\u0435 \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0440\u043e\u043a\u0435\u0440\u0430.\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u00a0\u0447\u0438\u0442\u0430\u0442\u044c, \u0442\u0430\u043c \u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u00a0\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0437\u0430\u043c\u0435\u0442\u043a\u0438, \u044f \u0435\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u00a0\u0441\u0432\u0451\u0440\u043d\u0443\u0442\u043e\u043c \u0432\u0438\u0434\u0435.server.properties############################# Server Basics ############################## The id of the broker. This must be set to a unique integer for each broker.broker.id=1broker.rack=DC1advertised.listeners=SASL_SSL:\/\/yamaha1.bercut.com:9093advertised.host.name=yamaha1.bercut.comlisteners=SASL_SSL:\/\/yamaha1.bercut.com:9093#Kerberoslistener.name.sasl_ssl.gssapi.sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true \\                              keyTab=&#187;\/opt\/kafka-secret\/kafka-server-yamaha1.keytab&#187; principal=&#187;KAFKA\/yamaha1.bercut.com&#187;;############################# End of Server Basics ################################################### Zookeeper #################################zookeeper.connection.timeout.ms=18000zookeeper.connect=yamaha1.bercut.com:2182,yamaha2.bercut.com:2182,yamaha3.bercut.com:2182## Properties for SSL Zookeeper Security between Zookeeper and Brokerzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNettyzookeeper.ssl.client.enable=truezookeeper.ssl.protocol=TLSv1.2zookeeper.ssl.truststore.location=\/opt\/kafka-config\/ssl\/kafka\/zookeeper-client.truststore.jkszookeeper.ssl.truststore.password=ChangeThisZKeySecretzookeeper.ssl.keystore.location=\/opt\/kafka-config\/ssl\/kafka\/zookeeper-client.keystore.jkszookeeper.ssl.keystore.password=ChangeThisZKeySecretzookeeper.set.acl=true############################ SSL and SASL settings ############################### put this line if your certificate does not contain FQDN#ssl.endpoint.identification.algorithm=ssl.keystore.location=\/opt\/kafka-config\/ssl\/kafka\/kafka.server.keystore.jksssl.keystore.password=ChangeThisKKeySecretssl.key.password=ChangeThisKKeySecretssl.truststore.location=\/opt\/kafka-config\/ssl\/kafka\/kafka.server.truststore.jksssl.truststore.password=ChangeThisKKeySecretssl.protocol=TLSv1.2security.inter.broker.protocol=SASL_SSL##ssl.client.auth=requiredssl.client.auth=none##Properties for SASL beetween the brokers and clients#sasl.enabled.mechanisms=SCRAM-SHA-512sasl.enabled.mechanisms=SCRAM-SHA-512,GSSAPIsasl.kerberos.service.name=kafkasasl.mechanism.inter.broker.protocol=SCRAM-SHA-512listener.name.sasl_ssl.scram-sha-512.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=&#187;broker-admin&#187; password=&#187;ChangeThisAdminSecret&#187;;super.users=User:broker-admin##Properties for Authorizationauthorizer.class.name=kafka.security.authorizer.AclAuthorizer# disable this for more security allow.everyone.if.no.acl.found=false############################# Socket Server Settings ############################## Maps listener names to security protocols, the default is for them to be the same. # See the config documentation for more details#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL# The number of threads that the server uses for receiving requests from the network and sending responses to the networknum.network.threads=8# The number of threads that the server uses for processing requests, which may include disk I\/Onum.io.threads=16# The send buffer (SO_SNDBUF) used by the socket serversocket.send.buffer.bytes=102400# The receive buffer (SO_RCVBUF) used by the socket serversocket.receive.buffer.bytes=102400# The maximum size of a request that the socket server will accept (protection against OOM)socket.request.max.bytes=104857600############################# Log Basics ############################## A comma separated list of directories under which to store log fileslog.dirs=\/data\/kafka-logs# The default number of log partitions per topic. More partitions allow greater# parallelism for consumption, but this will also result in more files across# the brokers.num.partitions=2# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.# This value is recommended to be increased for installations with data dirs located in RAID array.num.recovery.threads.per.data.dir=2############################# Internal Topic Settings  ############################## The replication factor for the group metadata internal topics &#171;__consumer_offsets&#187; and &#171;__transaction_state&#187;# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.offsets.topic.replication.factor=3transaction.state.log.replication.factor=3transaction.state.log.min.isr=2offsets.topic.min.isr=2############################# Log Flush Policy ############################## Messages are immediately written to the filesystem but by default we only fsync() to sync# the OS cache lazily. The following configurations control the flush of data to disk.# There are a few important trade-offs here:#    1. Durability: Unflushed data may be lost if you are not using replication.#    2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.#    3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.# The settings below allow one to configure the flush policy to flush data after a period of time or# every N messages (or both). This can be done globally and overridden on a per-topic basis.# The number of messages to accept before forcing a flush of data to disklog.flush.interval.messages=10000# The maximum amount of time a message can sit in a log before we force a flushlog.flush.interval.ms=1000############################# Log Retention Policy ############################## The following configurations control the disposal of log segments. The policy can# be set to delete segments after a period of time, or after a given size has accumulated.# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens# from the end of the log.# The minimum age of a log file to be eligible for deletion due to age#7 days#log.retention.hours=168#4 dayslog.retention.ms=345600000# A size-based retention policy for logs. Segments are pruned from the log unless the remaining# segments drop below log.retention.bytes. Functions independently of log.retention.hours.#1GBlog.retention.bytes=1073741824# The maximum size of a log segment file. When this size is reached a new log segment will be created#1GBlog.segment.bytes=1073741824# The interval at which log segments are checked to see if they can be deleted according# to the retention policies#5minlog.retention.check.interval.ms=300000############################# Group Coordinator Settings ############################## The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.# The default value for this is 3 seconds.# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.group.initial.rebalance.delay.ms=3000############################# General Topics Settings #############################delete.topic.enable=falseauto.create.topics.enable=falseconfig.storage.replication.factor=3replica.lag.time.max.ms=2000replica.fetch.wait.max.ms=200min.insync.replicas=2default.replication.factor=3unclean.leader.election.enable = falsenum.replica.fetchers=2############################ consumer local read connections priority ###################replica.selector.class=org.apache.kafka.common.replica.RackAwareReplicaSelector\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 \u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u0438, \u0430 \u0441\u0435\u043a\u0446\u0438\u044f &#171;Server Basics&#187; \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0432 server.properties.uniq.\u0412\u043e\u0442 \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043f\u043b\u0438\u0442. \u041f\u0435\u0440\u0435\u0434 \u0441\u043f\u043b\u0438\u0442\u043e\u043c \u043d\u0430\u00a0\u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. \u041f\u0438\u0448\u0435\u043c splitcfg.sh.#!\/bin\/bashcfg=&#187;server.properties&#187;mydir=$(dirname &#171;$0&#187;)cd &#171;${mydir}&#187;umask 026if [[ -f &#171;${cfg}.uniq&#187; ]]; then                 echo Saving old ${cfg}.uniq to ${cfg}.uniq.bak                mv ${cfg}.uniq ${cfg}.uniq.bakfiif [[ -f &#171;${cfg}.common&#187; ]]; then                echo Saving old ${cfg}.common to ${cfg}.common.bak                mv ${cfg}.common ${cfg}.common.bak fiuniqtxt=falsewhile read line; do        if [[ &#171;$line&#187; == &#171;############################# Server Basics #############################&#187; ]]; then                uniqtxt=true        fi        if [[ &#171;$uniqtxt&#187; == &#171;true&#187; ]]; then                echo &#171;$line&#187; &gt;&gt; ${cfg}.uniq        else                echo &#171;$line&#187; &gt;&gt; ${cfg}.common        fi        if [[ &#171;$line&#187; == &#171;############################# End of Server Basics ######################&#187; ]]; then                uniqtxt=false        fidone &lt; &lt;(cat &#171;${cfg}&#187;)\u041e\u0442\u043b\u0438\u0447\u043d\u043e, splitcfg.sh \u0433\u043e\u0442\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u043e&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-475206","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/475206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=475206"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/475206\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=475206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=475206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=475206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}