{"id":301408,"date":"2020-04-07T09:00:29","date_gmt":"2020-04-07T09:00:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301408"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301408","title":{"rendered":"\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 ZooKeeper \u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432 Apache Kafka"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/496032\/\">\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 <a href=\"https:\/\/zookeeper.apache.org\/\">ZooKeeper<\/a> (\u0441\u043b\u0443\u0436\u0431\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b), \u0434\u0432\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u0431\u0440\u043e\u043a\u0435\u0440\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 <a href=\"https:\/\/kafka.apache.org\/\">Kafka<\/a>, \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ow\/ui\/nt\/owuint44rztxj8owu1ba3rkino8.png\" alt=\"image\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u043c (producer) \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u043c (consumer) \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. <\/p>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c ZooKeeper \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u043f\u0430\u043a\u0435\u0442 Kafka, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h4>\n<p>  <b>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 Kafka<\/b><\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u2014 Ubuntu 16.04 LTS.<\/p>\n<p>  \u0410\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u2014 \u043d\u0430 <a href=\"https:\/\/kafka.apache.org\/downloads\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>.<\/p>\n<pre><code class=\"bash\">wget http:\/\/mirror.linux-ia64.org\/apache\/kafka\/2.4.1\/kafka_2.12-2.4.1.tgz tar -xvzf kafka_2.12-2.4.1.tgz <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0434\u043b\u044f \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 server_1, server_2 \u0438 server_3.<\/p>\n<pre><code class=\"bash\">mv kafka_2.12-2.4.1 kafka_server_1 cp -r kafka_server_1\/ kafka_server_2\/ cp -r kafka_server_1\/ kafka_server_3\/<\/code><\/pre>\n<p>  <b>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0443\u0437\u043b\u043e\u0432<\/b><\/p>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Kafka-\u0431\u0440\u043e\u043a\u0435\u0440\u0430<br \/>  (\u0438\u0437 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 kafka_server_1, kafka_server_2 \u0438 kafka_server_3 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e)<\/p>\n<pre><code class=\"bash\">vim config\/server.properties<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>id \u0431\u0440\u043e\u043a\u0435\u0440\u0430 (0, 1, 2 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e)<\/li>\n<li>\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043f\u043e\u0440\u0442 (9092, 9093, 9094)<\/li>\n<li>\u043f\u043e\u0440\u0442 ZooKeeper (2181, 2182, 2183)<\/li>\n<li>\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u043b\u043e\u0433\u043e\u0432 (\/tmp\/kafka-logs-1, \/tmp\/kafka-logs-2, \/tmp\/kafka-logs-3)<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"bash\">broker.id=0 listeners=PLAINTEXT:\/\/:9092 zookeeper.connect=localhost:2181    log.dirs=\/tmp\/kafka-logs-1<\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f znode:<\/p>\n<pre><code class=\"bash\">vim config\/zookeeper.properties<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\/tmp\/zookeeper_1, \/tmp\/zookeeper_2, \/tmp\/zookeeper_3)<\/li>\n<li>\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043f\u043e\u0440\u0442 (2181, 2182, 2183)<\/li>\n<li>\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0438 \u043b\u0438\u043c\u0438\u0442\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/li>\n<li>\u043f\u043e\u0440\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438 (\u0442. \u0435. \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0443\u0437\u043b\u0443 \u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445)<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"bash\">dataDir=\/tmp\/zookeeper_1 clientPort=2181 maxClientCnxns=60 initLimit=10 syncLimit=5 tickTime=2000 server.1=localhost:2888:3888 server.2=localhost:2889:3889 server.3=localhost:2890:3890<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u0443\u0437\u043b\u043e\u0432 ZooKeeper, \u0437\u0430\u043f\u0438\u0441\u044c id \u0443\u0437\u043b\u043e\u0432 \u0432 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<pre><code class=\"bash\">mkdir -p \/tmp\/zookeeper_[1..3] echo &quot;1&quot; &gt;&gt; \/tmp\/zookeeper_1\/myid echo &quot;2&quot; &gt;&gt; \/tmp\/zookeeper_2\/myid echo &quot;3&quot; &gt;&gt; \/tmp\/zookeeper_3\/myid<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0445 \u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo chmod 777 \/tmp\/zookeeper_1<\/code><\/pre>\n<p>  <\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a z-\u0443\u0437\u043b\u043e\u0432 \u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432<\/h4>\n<p>  \u0414\u043b\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0443\u0437\u043b\u043e\u0432 (kafka_server_1\/, kafka_server_2\/) \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b ZooKeeper \u0438 Kafka-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<pre><code class=\"bash\">sudo bin\/zookeeper-server-start.sh config\/zookeeper.properties sudo bin\/kafka-server-start.sh config\/server.properties<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0443\u0437\u043b\u0430 (kafka_server_3\/) \u2014 \u0442\u043e\u043b\u044c\u043a\u043e ZooKeeper.<\/p>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo bin\/kafka-server-stop.sh sudo bin\/zookeeper-server-stop.sh<\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0435\u043c\u044b, \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e producer-\u0430 \u0438 consumer-\u0430<\/h4>\n<p>  \u0422\u0435\u043c\u0430 (topic) \u2014 \u043f\u043e\u0442\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u043e\u043c &#8212;partition). \u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0443\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 (&#8212;replication-factor). \u041f\u043e\u0441\u043b\u0435 \u043a\u043b\u044e\u0447\u0430 &#8212;bootstrap-server \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e \u043f\u043e\u0440\u0442\u044b Kafka-\u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432. \u041a\u043b\u044e\u0447 &#8212;topic \u0437\u0430\u0434\u0430\u0435\u0442 \u0438\u043c\u044f \u0442\u0435\u043c\u044b.<\/p>\n<pre><code class=\"bash\">sudo bin\/kafka-topics.sh --create --bootstrap-server localhost:9092,localhost:9093 --replication-factor 2 --partitions 2 --topic TestTopic<\/code><\/pre>\n<p>  \u0423\u0437\u043d\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u043f\u0438\u043a\u043e\u0432 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u043e\u043f\u0438\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">sudo bin\/kafka-topics.sh --list --zookeeper localhost:2181            sudo bin\/kafka-topics.sh --zookeeper localhost:2181 --describe --topic TestTopic<\/code><\/pre>\n<p>  Leader \u2014 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438, replica \u2014 \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, ISR \u2014 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0431\u0435\u0440\u0443\u0449\u0438\u0435 \u043d\u0430 \u0441\u0435\u0431\u044f \u0440\u043e\u043b\u044c \u043b\u0438\u0434\u0435\u0440\u043e\u0432 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 leader.<\/p>\n<p>  Console producer, console consumer \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432:<\/p>\n<pre><code class=\"bash\">sudo bin\/kafka-console-producer.sh --broker-list localhost:9092,localhost:9093 --topic TestTopic sudo bin\/kafka-console-consumer.sh --bootstrap-server localhost:9092,localhost:9093 --from-beginning --topic TestTopic<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0439.<\/p>\n<h4>\u0421\u0435\u0440\u0432\u0438\u0441\u044b \u0434\u043b\u044f zookeeper \u0438 kafka \u0432 systemctl<\/h4>\n<p>  \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432 systemctl: zookeeper_1.service, zookeeper_2.service, zookeeper_3.service, kafka_1.service, kafka_2.service.<\/p>\n<p>  \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b \/etc\/systemd\/system\/zookeeper_1.service (\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/home\/user \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f user \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043d\u0443\u0436\u043d\u044b\u0435). <\/p>\n<pre><code class=\"bash\">[Unit] Requires=network.target remote-fs.target After=network.target remote-fs.target  [Service] Type=simple User=user ExecStart=home\/user\/kafka_server_1\/bin\/zookeeper-server-start.sh \/home\/user\/kafka_server_1\/config\/zookeeper.properties ExecStop=\/home\/user\/kafka_server_1\/bin\/zookeeper-server-stop.sh Restart=on-abnormal  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 zookeeper_2.service \u0438 zookeeper_3.service \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>  \u0424\u0430\u0439\u043b \/etc\/systemd\/system\/kafka_1.service:  <\/p>\n<pre><code class=\"bash\">[Unit] Requires=zookeeper.service After=zookeeper.service  [Service] Type=simple User=user ExecStart=\/bin\/sh -c '\/home\/user\/kafka_server_1\/bin\/kafka-server-start.sh \/home\/user\/kafka_server_1\/config\/server.properties &gt; \/tmp\/kafka-logs-1 2&gt;&1' ExecStop=\/home\/user\/kafka_server_1\/bin\/kafka-server-stop.sh Restart=on-abnormal  [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>  kafka_2.service \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>  <b>\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/b><\/p>\n<pre><code class=\"bash\">systemctl daemon-reload systemctl enable zookeeper_1.service # \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0430 systemctl start zookeeper_1.service sudo journalctl -u zookeeper_1.service # \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0435 systemctl stop zookeeper_1.service<\/code><\/pre>\n<p>  \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f zookeeper_2.service, zookeeper_3.service, kafka_1.service, kafka_1.service.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p><\/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\/post\/496032\/\"> https:\/\/habr.com\/ru\/post\/496032\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/496032\/\">\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 <a href=\"https:\/\/zookeeper.apache.org\/\">ZooKeeper<\/a> (\u0441\u043b\u0443\u0436\u0431\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b), \u0434\u0432\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u2014 \u0431\u0440\u043e\u043a\u0435\u0440\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 <a href=\"https:\/\/kafka.apache.org\/\">Kafka<\/a>, \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ow\/ui\/nt\/owuint44rztxj8owu1ba3rkino8.png\" alt=\"image\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-301408","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301408","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=301408"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301408\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}