{"id":356300,"date":"2024-05-20T23:26:41","date_gmt":"2024-05-20T23:26:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=356300"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=356300","title":{"rendered":"<span>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 Zookeeper: SASL with Digest-MD5<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/3ff\/9e0\/838\/3ff9e08386abca55a0dba011aa5ad745.jpg\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ff\/9e0\/838\/3ff9e08386abca55a0dba011aa5ad745.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c SSL \u0438 SASL \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 Linux \u0443\u0437\u043b\u043e\u0432 Zookeeper, \u0438 \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p> \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a: <\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Zookeeper \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u0431\u0435\u0437 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f (Plain);<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0438\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (Quorum TLS);<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0443\u0437\u043b\u0430\u043c Zookeeper \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 (Server TLS);<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043a \u0443\u0437\u043b\u0430\u043c (Client TLS);<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 (SASL with MD5);<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 ACL, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c super \u043e\u0442 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 (\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 ACL \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438).<\/p>\n<\/li>\n<\/ul>\n<h2>Plain<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043a\u0430\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0437\u0430 \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u043d\u0430\u0447\u043d\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u0435\u0435.<\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u0440\u0438 \u0443\u0437\u043b\u0430 \u0441 Linux, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 AlmaLinux 9.2.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0437\u043d\u0430\u043b\u0438 \u0441\u0432\u043e\u0438 \u0438\u043c\u0435\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c DNS, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0445 \u0438\u043c\u0435\u043d\u0430\u0445 \u0432 \/etc\/hosts \u043d\u0430 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u0430\u0445:<\/p>\n<pre><code>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.11 zoo1.local zoo1 192.168.1.12 zoo2.local zoo2  192.168.1.13 zoo3.local zoo3<\/code><\/pre>\n<p><strong>\u041d\u0438\u0436\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 hostname -f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0436\u043d\u043e, \u0432 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0438\u043c\u0435\u043d\u0430 \u0432 \/etc\/hosts (\u0441\u043d\u0430\u0447\u0430\u043b\u0430 zoo1.local, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c zoo1, \u043d\u043e \u043d\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442).<\/strong><\/p>\n<p>\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Zookeeper(Zk) \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 JDK11 LTS (\u0432 \u0441\u043f\u0438\u0441\u043a\u0435 JDK 8 LTS, JDK 11 LTS, JDK 12 ), \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0451 \u043d\u0430 \u0432\u0441\u0435 \u0443\u0437\u043b\u044b:<\/p>\n<pre><code>sudo dnf install -y java-11-openjdk.x86_64<\/code><\/pre>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 Zk, \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u044f 3.8.3:<\/p>\n<pre><code>wget https:\/\/dlcdn.apache.org\/zookeeper\/stable\/apache-zookeeper-3.8.3-bin.tar.gz<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 Zk \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/dlcdn.apache.org\/zookeeper\/stable\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f zookeeper:<\/p>\n<pre><code>sudo useradd -m -d \/opt\/zookeeper -s \/bin\/bash zookeeper<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0448\u0435\u043b\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \/bin\/false. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043f\u0430\u043f\u043a\u0443 \/opt\/zookeeper. <\/p>\n<p>\u0420\u0430\u0441\u043f\u0430\u043a\u0443\u0435\u043c \u0432 \u043d\u0435\u0435 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432, \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code>sudo tar -xf apache-zookeeper-3.8.3-bin.tar.gz --directory \/opt\/zookeeper sudo chown -R zookeeper:zookeeper \/opt\/zookeeper sudo su - zookeeper mv apache-zookeeper-3.8.3-bin\/{bin,conf,lib,docs} .  rm -r apache-zookeeper-3.8.3-bin mkdir -m 700 ssl client-settings data .ssh<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u0444\u0430\u0439\u043b \/opt\/zookeeper\/conf\/zookeeper.properties:<\/p>\n<pre><code>dataDir=\/opt\/zookeeper\/data  # zoo cluster node info #server.id=hostname:port1:port2   # id - The ID of the Zookeeper cluster node.   # hostname - The hostname or IP address where the node listens for connections.   # port1 - The port number used for intra-cluster communication.   # port2 - The port number used for leader election. server.1=zoo1.local:2888:3888 server.2=zoo2.local:2888:3888 server.3=zoo3.local:2888:3888  ## Metrics Providers # https:\/\/prometheus.io Metrics Exporter metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider metricsProvider.httpHost=0.0.0.0 metricsProvider.httpPort=8006 metricsProvider.exportJvmInfo=true  # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial synchronization phase can take initLimit=10 # The number of ticks that can pass between sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored.   #max client connections number maxClientCnxns=60  # the port at which the clients will connect in plain text (it should be commented and disabled) clientPort=2181<\/code><\/pre>\n<p>\u0418 \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043d\u0430\u043f\u0438\u0448\u0435\u043c unit file \u0434\u043b\u044f systemd \/etc\/systemd\/system\/zookeeper.service. \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0430\u0436\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e JAVA_HOME, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e ZK_SERVER_HEAP \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043c HEAP \u043f\u0430\u043c\u044f\u0442\u044c:<\/p>\n<pre><code>exit sudo vim \/etc\/systemd\/system\/zookeeper.service<\/code><\/pre>\n<pre><code>[Unit] Description=Apache Zookeeper server Documentation=http:\/\/zookeeper.apache.org Requires=network.target remote-fs.target After=network.target remote-fs.target   [Service] Type=forking User=zookeeper Group=zookeeper  Environment=\"JAVA_HOME=\/usr\/lib\/jvm\/jre-11\"  #default heap size is 1000 Mb (set in zkEnv.sh) Environment=\"ZK_SERVER_HEAP=2000\"  ExecStart=\/opt\/zookeeper\/bin\/zkServer.sh start \/opt\/zookeeper\/conf\/zookeeper.properties ExecStop=\/opt\/zookeeper\/bin\/zkServer.sh stop Restart=always   [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0432\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u0430\u0436\u043d\u043e \u0432 \u043f\u0430\u043f\u043a\u0435 data \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0443\u0437\u043b\u043e\u0432. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code>sudo su - zookeeper # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435  echo 1 > \/opt\/zookeeper\/data\/myid  # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0443\u0437\u043b\u0435 echo 2 > \/opt\/zookeeper\/data\/myid  # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0443\u0437\u043b\u0435 echo 3 > \/opt\/zookeeper\/data\/myid exit<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0447\u0438\u0442\u0430\u0435\u043c unit \u0444\u0430\u0439\u043b systemd, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0441\u044f \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a Zk \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043d\u043e \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u044b Zk:<\/p>\n<pre><code>sudo systemctl daemon-reload sudo systemctl enable --now zookeeper sudo systemctl status zookeeper --no-pager sudo su - zookeeper bin\/zkCli.sh -server 127.0.0.1:2181 ls \/zookeeper       #\u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443       #[config, quota] tail -f logs\/zookeeper-zookeeper-server-$(hostname -f).out<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0443\u0447\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0443\u0437\u043b\u044b \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u2014 \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u044b \/opt\/zookeeper\/data\/myid \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440.<\/p>\n<h2>Quorum TLS<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0435\u0440\u0438\u0438 \u043c\u044b \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0430\u043f\u043a\u0443 \/opt\/zookeeper\/ssl, \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043b\u044e\u0447\u0435\u0439. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. <\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \/opt\/zookeeper\/ssl, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u2014 Quorum-TLS-CA. \u0412 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c \u043a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430:<\/p>\n<pre><code>cd \/opt\/zookeeper\/ssl mkdir -m 700 Quorum-TLS-CA<\/code><\/pre>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0443\u0437\u043b\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0435\u043c CA \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f Quorum, \u0441\u043e \u0441\u0440\u043e\u043a\u043e\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 10 \u043b\u0435\u0442:<\/p>\n<pre><code>openssl req -new -newkey rsa:4096 -days 3650 -x509 -subj \"\/CN=ZooKeeper-Security-CA\" -keyout Quorum-TLS-CA\/ca-key -out Quorum-TLS-CA\/ca-cert -nodes<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Quorum-TLS-CA\/ca-key \u0438 Quorum-TLS-CA\/ca-cert \u043d\u0430 \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0437\u043b\u044b (\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 CA \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435, \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u043e\u0434\u0438\u043d):<\/p>\n<pre><code># \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435 ssh-keygen -C zookeeperKey -t ed25519 cat \/opt\/zookeeper\/.ssh\/id_ed25519.pub >> \/opt\/zookeeper\/.ssh\/authorized_keys chmod 600 \/opt\/zookeeper\/.ssh\/authorized_keys cat \/opt\/zookeeper\/.ssh\/id_ed25519     #\u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 cat \/opt\/zookeeper\/.ssh\/id_ed25519.pub     #\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447  # \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0443\u0437\u043b\u0435 mkdir .ssh vim \/opt\/zookeeper\/.ssh\/id_ed25519     #\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 vim \/opt\/zookeeper\/.ssh\/authorized_keys     #\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 chmod 600 \/opt\/zookeeper\/.ssh\/authorized_keys \/opt\/zookeeper\/.ssh\/id_ed25519  # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435 cd \/opt\/zookeeper\/ssl scp Quorum-TLS-CA\/* zoo2.local:\/opt\/zookeeper\/ssl\/Quorum-TLS-CA scp Quorum-TLS-CA\/* zoo3.local:\/opt\/zookeeper\/ssl\/Quorum-TLS-CA<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0432\u043e\u0440\u0443\u043c\u0430. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 key\/trust:<\/p>\n<pre><code>export QPASS=ChangeMeSecretQpass<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 (truststore) \u0434\u043b\u044f zookeeper-quorum, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 CA. \u0424\u0430\u0439\u043b \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f zookeeper-quorum.truststore.jks:<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.truststore.jks -alias CARoot -import -file Quorum-TLS-CA\/ca-cert -storepass $QPASS -keypass $QPASS -noprompt<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 (keystore) \u0434\u043b\u044f zookeeper-quorum. \u0422\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0443\u0437\u043b\u0430, \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0448\u0435\u043b\u043b\u0430 $(hostname -f) \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code>keytool -genkeypair -alias $(hostname -f) -keyalg RSA -keysize 2048 -dname \"cn=$(hostname -f)\" -keypass $QPASS -keystore zookeeper-quorum.keystore.jks -storepass $QPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0435\u043c CSR (Certificate Signing Request) = \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0434\u0430\u0447\u0443 (\u043f\u043e\u0434\u043f\u0438\u0441\u044c) SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430:<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.keystore.jks -alias $(hostname -f) -certreq -file ca-request-zookeeper-$(hostname -f) -storepass $QPASS -keypass $QPASS<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Quorum-TLS-CA\/ca-key \u0438 Quorum-TLS-CA\/ca-cert \u043d\u0430 \u0432\u0441\u0435 \u0443\u0437\u043b\u044b, \u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u044d\u0442\u0438\u0445 CSR, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0442\u0430\u043c, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c CA.<\/p>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 ca-key \u0438 ca-cert \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<pre><code>openssl x509 -req -CA Quorum-TLS-CA\/ca-cert -CAkey Quorum-TLS-CA\/ca-key -in ca-request-zookeeper-$(hostname -f) -out cert-zookeeper-$(hostname -f)-signed -days 3650 -CAcreateserial -passin pass:$QPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 CA \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 Zookeeper (keystore):<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.keystore.jks -import -file Quorum-TLS-CA\/ca-cert -storepass $QPASS -keypass $QPASS -noprompt -alias CARoot<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 Zookeeper \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 keystore:<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.keystore.jks -import -file cert-zookeeper-$(hostname -f)-signed -storepass $QPASS -keypass $QPASS -alias $(hostname -f) -noprompt<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 zookeeper-quorum.keystore.jks \u0435\u0441\u0442\u044c CA \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u041e\u0414\u041d\u041e\u0413\u041e \u0443\u0437\u043b\u0430 (\u0442.\u0435. \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435):<\/p>\n<pre><code>keytool -list -v -keystore zookeeper-quorum.keystore.jks -storepass $QPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b CSR, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 Zookeeper (\u043e\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u0432 keystore):<\/p>\n<pre><code>rm cert-zookeeper-*-signed  ca-request-zookeeper-* Quorum-TLS-CA\/ca-cert.srl<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0432 \/opt\/zookeeper\/conf\/zookeeper.properties \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u041e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u0434\u043e \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044e: \u0440\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u0435\u0433\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 QPASS, \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0432\u0430\u0436\u0434\u044b.<\/p>\n<pre><code>#Quorum TLS sslQuorum=true  serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory  ssl.quorum.keyStore.location=\/opt\/zookeeper\/ssl\/zookeeper-quorum.keystore.jks ssl.quorum.keyStore.password=ChangeMeSecretQpass ssl.quorum.trustStore.location=\/opt\/zookeeper\/ssl\/zookeeper-quorum.truststore.jks ssl.quorum.trustStore.password=ChangeMeSecretQpass<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Zookeeper, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043b\u043e\u0433\u0438, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f:<\/p>\n<pre><code>exit sudo systemctl restart zookeeper sudo su - zookeeper tail -f logs\/zookeeper-zookeeper-server-$(hostname -f).out<\/code><\/pre>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e TLS, \u043d\u043e \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u043f\u043e\u043a\u0430 PLAIN:<\/p>\n<pre><code>\/opt\/zookeeper\/bin\/zkCli.sh -server 127.0.0.1:2181 ls \/zookeeper<\/code><\/pre>\n<h2>Server TLS<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c CA \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u0443\u0437\u043b\u043e\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Zookeeper \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u0417\u0430\u0442\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0443\u0437\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c CA \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0441\u0440\u043e\u043a\u043e\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f 10 \u043b\u0435\u0442, \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0435 Client-TLS-CA:<\/p>\n<pre><code>cd \/opt\/zookeeper\/ssl mkdir -m 700 Client-TLS-CA openssl req -new -newkey rsa:4096 -days 3650 -x509 -subj \"\/CN=ZooKeeper-Client-CA\" -keyout Client-TLS-CA\/ca-key -out Client-TLS-CA\/ca-cert -nodes <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Client-TLS-CA\/ca-key \u0438 Client-TLS-CA\/ca-cert \u043d\u0430 \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0437\u043b\u044b (\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 CA \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435, \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u043e\u0434\u0438\u043d):<\/p>\n<pre><code># \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435 cd \/opt\/zookeeper\/ssl for h in zoo2.local zoo3.local; do   ssh ${h} mkdir -m 700 \/opt\/zookeeper\/ssl\/Client-TLS-CA   scp Client-TLS-CA\/* ${h}:\/opt\/zookeeper\/ssl\/Client-TLS-CA done<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 key\/trust:<\/p>\n<pre><code>export SPASS=ChangeMeSecretSpass<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 (truststore) \u0434\u043b\u044f zookeeper-server, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 CA:<\/p>\n<pre><code>keytool -keystore zookeeper-server.truststore.jks -alias CARoot -import -file Client-TLS-CA\/ca-cert -storepass $SPASS -keypass $SPASS -noprompt<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 (keystore) \u0434\u043b\u044f zookeeper-server. \u0422\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f  \u0438\u043c\u044f \u0443\u0437\u043b\u0430, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0448\u0435\u043b\u043b\u0430 $(hostname -f):<\/p>\n<pre><code>keytool -genkeypair -alias $(hostname -f) -keyalg RSA -keysize 2048 -dname \"cn=$(hostname -f)\" -keypass $SPASS -keystore zookeeper-server.keystore.jks -storepass $SPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c CSR (Certificate Signing Request) = \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0434\u0430\u0447\u0443 (\u043f\u043e\u0434\u043f\u0438\u0441\u044c) SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430:<\/p>\n<pre><code>keytool -keystore zookeeper-server.keystore.jks -alias $(hostname -f) -certreq -file ca-request-zookeeper-$(hostname -f) -storepass $SPASS -keypass $SPASS<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 ca-key \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0438:<\/p>\n<pre><code>openssl x509 -req -CA Client-TLS-CA\/ca-cert -CAkey Client-TLS-CA\/ca-key -in ca-request-zookeeper-$(hostname -f) -out cert-zookeeper-$(hostname -f)-signed -days 3650 -CAcreateserial -passin pass:$SPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 CA \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 Zookeeper (keystore):<\/p>\n<pre><code>keytool -keystore zookeeper-server.keystore.jks -import -file Client-TLS-CA\/ca-cert -storepass $SPASS -keypass $SPASS -noprompt -alias CARoot<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 zookeeper \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 Zookeeper (keystore):<\/p>\n<pre><code>keytool -keystore zookeeper-server.keystore.jks -import -file cert-zookeeper-$(hostname -f)-signed -storepass $SPASS -keypass $SPASS -alias $(hostname -f) -noprompt<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0435\u0441\u0442\u044c CA \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u041e\u0414\u041d\u041e\u0413\u041e \u0443\u0437\u043b\u0430 (\u0442.\u0435. \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435):<\/p>\n<pre><code>keytool -list -v -keystore zookeeper-server.keystore.jks -storepass $SPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b CSR, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 zookeeper-client (\u043e\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u0432 keystore):<\/p>\n<pre><code>rm cert-zookeeper-*-signed  ca-request-zookeeper-* Client-TLS-CA\/ca-cert.srl<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \/opt\/zookeeper\/conf\/zookeeper.properties, \u0443\u0434\u0435\u043b\u044f\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044e ChangeMeSecretSpass:<\/p>\n<pre><code>#Server TLS secureClientPort=2182 authProvider.x509=org.apache.zookeeper.server.auth.X509AuthenticationProvider serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory ssl.trustStore.location=\/opt\/zookeeper\/ssl\/zookeeper-server.truststore.jks ssl.trustStore.password=ChangeMeSecretSpass ssl.keyStore.location=\/opt\/zookeeper\/ssl\/zookeeper-server.keystore.jks ssl.keyStore.password=ChangeMeSecretSpass ssl.hostnameVerification=false                                                                                                                                           ssl.clientAuth=need  <\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 &#8212; \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u043d\u0435\u0439 #:<\/p>\n<pre><code>#clientPort=2181<\/code><\/pre>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043e\u043d\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u0430 \u0437\u0430 \u043d\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 ssl.hostnameVerification=false \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043e\u0431\u0435\u0437\u043b\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c, \u0438 \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d \u0438\u0445 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 hostname.<\/p>\n<h2>Client-TLS<\/h2>\n<p>\u041d\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0443\u0437\u043b\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u0435\u0437\u043b\u0438\u0447\u0435\u043d\u043d\u044b\u0435 store \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. CA \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0442 \u0436\u0435, \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b, \u043f\u0440\u043e\u0441\u0442\u043e \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u043f\u043e \u043c\u0430\u0441\u043a\u0435 &#8216;*.local&#8217;. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0441\u0435\u0445 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 ssl.clientAuth=none (\u043d\u043e \u0442\u0430\u043a \u044f \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b).<\/p>\n<p>\u0414\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c, \u043d\u043e \u0442\u043e\u0442 \u0436\u0435 CA.<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432 \/opt\/zookeeper\/client-settings:<\/p>\n<pre><code>cd \/opt\/zookeeper\/client-settings\/ export CPASS=ChangeMeSecretCpass #truststore keytool -keystore zookeeper-client.truststore.jks -alias CARoot -import -file ..\/ssl\/Client-TLS-CA\/ca-cert -storepass $CPASS -keypass $CPASS -noprompt #keystore keytool -genkeypair -alias zkclient -keyalg RSA -keysize 2048 -dname \"cn=*.local\" -keypass $CPASS -keystore zookeeper-client.keystore.jks -storepass $CPASS #gen CSR keytool -keystore zookeeper-client.keystore.jks -alias zkclient -certreq -file ca-request-zookeeper-zkclient -storepass $CPASS -keypass $CPASS #sign openssl x509 -req -CA ..\/ssl\/Client-TLS-CA\/ca-cert -CAkey ..\/ssl\/Client-TLS-CA\/ca-key -in ca-request-zookeeper-zkclient -out cert-zookeeper-zkclient-signed -days 3650 -CAcreateserial -passin pass:$CPASS #import signed keytool -keystore zookeeper-client.keystore.jks -import -file ..\/ssl\/Client-TLS-CA\/ca-cert -storepass $CPASS -keypass $CPASS -noprompt -alias CARoot keytool -keystore zookeeper-client.keystore.jks -import -file cert-zookeeper-zkclient-signed -storepass $CPASS -keypass $CPASS -alias zkclient -noprompt #check keytool -list -v -keystore zookeeper-client.keystore.jks -storepass $CPASS #clean up rm cert-zookeeper-*-signed  ca-request-zookeeper-* ..srl<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 zkCli.sh \/opt\/zookeeper\/client-settings\/zookeeper-client.properties, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c ChangeMeSecretCpass:<\/p>\n<pre><code>zookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty zookeeper.client.secure=true zookeeper.ssl.client.enable=true zookeeper.ssl.protocol=TLSv1.2 zookeeper.ssl.trustStore.location=\/opt\/zookeeper\/client-settings\/zookeeper-client.truststore.jks zookeeper.ssl.trustStore.password=ChangeMeSecretCpass zookeeper.ssl.keyStore.location=\/opt\/zookeeper\/client-settings\/zookeeper-client.keystore.jks zookeeper.ssl.keyStore.password=ChangeMeSecretCpass  ##client will NOT ignore Zk server hostname #zookeeper.ssl.hostnameVerification=false<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043f\u043a\u0438 \/opt\/zookeeper\/client-settings \u043c\u043e\u0436\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Zk, \u0438 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u0451 \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c Zk:<\/p>\n<pre><code>scp \/opt\/zookeeper\/client-settings\/* zoo2.local:\/opt\/zookeeper\/client-settings\/ scp \/opt\/zookeeper\/client-settings\/* zoo3.local:\/opt\/zookeeper\/client-settings\/<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 Zookeeper c \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439. \u041c\u044b \u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c, \u0430 \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 systemd \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442:<\/p>\n<pre><code>for h in zoo{1..3}.local ; do    echo Reloading Zk on $h   ssh $h \"pkill -u zookeeper java &amp;&amp; sleep 5\" done<\/code><\/pre>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e SSL:<\/p>\n<pre><code>\/opt\/zookeeper\/bin\/zkCli.sh -server zoo1.local:2182 -client-configuration \/opt\/zookeeper\/client-settings\/zookeeper-client.properties ls \/zookeeper<\/code><\/pre>\n<h2>SASL with MD5<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d ACL, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c, \u0442.\u043a. \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Zk \u0441\u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c (\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439), \u043d\u043e \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0432 \/opt\/zookeeper\/conf\/zookeeper.properties:<\/p>\n<pre><code>#SASL with Digest-MD5 requireClientAuthScheme=sasl zookeeper.allowSaslFailedClients=false zookeeper.sessionRequireClientSASLAuth=true # You must add the authProvider.&lt;ID> property for every server that is part of the Zookeeper cluster authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider authProvider.2=org.apache.zookeeper.server.auth.SASLAuthenticationProvider authProvider.3=org.apache.zookeeper.server.auth.SASLAuthenticationProvider<\/code><\/pre>\n<p>authProvider \u0442\u0443\u0442 \u0442\u0440\u0438, \u043f\u043e \u0447\u0438\u0441\u043b\u0443 \u0443\u0437\u043b\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 1,2,3.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 Zookeeper \u0435\u0441\u0442\u044c \u0433\u043b\u044e\u043a, \u0438 \u043e\u043d \u043d\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0443 \u043a\u0430\u043a \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c, \u0442\u0430\u043a \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0437\u0436\u0435 \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u0432 unit \u0444\u0430\u0439\u043b systemd, \u0442\u0430\u043c \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \/opt\/zookeeper\/client-settings\/zookeeper-client-jaas.conf. \u042d\u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c:<\/p>\n<pre><code>Client {    org.apache.zookeeper.server.auth.DigestLoginModule required    username=\"bercut\"    password=\"ChangeMeSecretBUpass\"; };<\/code><\/pre>\n<p>\u0410 \/opt\/zookeeper\/conf\/zookeeper-server-jaas.conf &#8212; \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438. \u041e\u0441\u043e\u0431\u0443\u044e \u0440\u043e\u043b\u044c \u0438\u0433\u0440\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c super, \u0442.\u043a. \u043d\u0430 \u043d\u0435\u0433\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0430 ACL, \u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0435. \u0412\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 bercut \u0438 test \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435:<\/p>\n<pre><code>QuorumServer {    org.apache.zookeeper.server.auth.DigestLoginModule required    user_zookeeper=\"ChangeMeSecretZUpass\"; }; QuorumLearner {        org.apache.zookeeper.server.auth.DigestLoginModule required    username=\"zookeeper\"    password=\"ChangeMeSecretZUpass\"; }; Server {    org.apache.zookeeper.server.auth.DigestLoginModule required    user_super=\"ChangeMeSecretSUpass\"    user_bercut=\"ChangeMeSecretBUpass\"    user_test=\"ChangeMeSecretTUpass\"; };<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u0430\u0436\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 unit systemd \/etc\/systemd\/system\/zookeeper.service:<\/p>\n<pre><code>Environment=\"SERVER_JVMFLAGS=-Djava.security.auth.login.config=\/opt\/zookeeper\/conf\/zookeeper-server-jaas.conf \\  -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider \\  -Dzookeeper.authProvider.2=org.apache.zookeeper.server.auth.SASLAuthenticationProvider \\  -Dzookeeper.authProvider.3=org.apache.zookeeper.server.auth.SASLAuthenticationProvider \\  -Dzookeeper.allowSaslFailedClients=false \\  -Dzookeeper.sessionRequireClientSASLAuth=true\"<\/code><\/pre>\n<pre><code>exit sudo vim \/etc\/systemd\/system\/zookeeper.service sudo systemctl daemon-reload sudo systemctl restart zookeeper.service sudo su - zookeeper<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 jaas, \u0442\u043e Zk \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438 \u0441 \u043f\u0430\u0440\u043e\u043b\u0435\u043c, \u0438 \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f \u043f\u043e SSL. \u042d\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e SSL.<\/p>\n<details class=\"spoiler\">\n<summary>\/opt\/zookeeper\/conf\/zookeeper.properties (\u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code># zoo cluster node info    #server.id=hostname:port1:port2       # id - The ID of the Zookeeper cluster node.       # hostname - The hostname or IP address where the node listens for connections.       # port1 - The port number used for intra-cluster communication.       # port2 - The port number used for leader election. server.1=zoo1.local:2888:3888 server.2=zoo2.local:2888:3888 server.3=zoo3.local:2888:3888  # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial synchronization phase can take initLimit=10 # The number of ticks that can pass between sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored.  dataDir=\/opt\/zookeeper\/data # the port at which the clients will connect in plain text (it should be commented and disabled) #clientPort=2181  # the maximum number of client connections. increase this if you need to handle more clients maxClientCnxns=60 # # Be sure to read the maintenance section of the  # administrator guide before turning on autopurge. # # https:\/\/zookeeper.apache.org\/doc\/current\/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir autopurge.snapRetainCount=3 # Purge task interval in hours # Set to \"0\" to disable auto purge feature autopurge.purgeInterval=1  ## Metrics Providers # https:\/\/prometheus.io Metrics Exporter metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider metricsProvider.httpHost=0.0.0.0 metricsProvider.httpPort=8006 metricsProvider.exportJvmInfo=true  #Quorum TLS sslQuorum=true  serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory  ssl.quorum.keyStore.location=\/opt\/zookeeper\/ssl\/zookeeper-quorum.keystore.jks ssl.quorum.keyStore.password=ChangeMeSecretQpass ssl.quorum.trustStore.location=\/opt\/zookeeper\/ssl\/zookeeper-quorum.truststore.jks ssl.quorum.trustStore.password=ChangeMeSecretQpass ssl.quorum.hostnameVerification=true  #Server TLS secureClientPort=2182 authProvider.x509=org.apache.zookeeper.server.auth.X509AuthenticationProvider serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory ssl.trustStore.location=\/opt\/zookeeper\/ssl\/zookeeper-server.truststore.jks ssl.trustStore.password=ChangeMeSecretCpass ssl.keyStore.location=\/opt\/zookeeper\/ssl\/zookeeper-server.keystore.jks ssl.keyStore.password=ChangeMeSecretCpass ssl.hostnameVerification=false ssl.clientAuth=none  #Quorum SASL quorum.auth.enableSasl=true quorum.auth.learnerRequireSasl=true quorum.auth.serverRequireSasl=true quorum.auth.learner.loginContext=QuorumLearner quorum.auth.server.loginContext=QuorumServer quorum.cnxn.threads.size=20  #SASL with Digest-MD5 requireClientAuthScheme=sasl zookeeper.allowSaslFailedClients=false zookeeper.sessionRequireClientSASLAuth=true # You must add the authProvider.&lt;ID> property for every server that is part of the Zookeeper cluster authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider authProvider.2=org.apache.zookeeper.server.auth.SASLAuthenticationProvider authProvider.3=org.apache.zookeeper.server.auth.SASLAuthenticationProvider<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\/etc\/systemd\/system\/zookeeper.service (\u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>[Unit] Description=Apache Zookeeper server Documentation=http:\/\/zookeeper.apache.org Requires=network.target remote-fs.target After=network.target remote-fs.target   [Service] Type=forking User=zookeeper Group=zookeeper  Environment=\"JAVA_HOME=\/usr\/lib\/jvm\/jre-11\"  #default heap size is 1000 Mb (set in zkEnv.sh) Environment=\"ZK_SERVER_HEAP=2000\"  Environment=\"SERVER_JVMFLAGS=-Djava.security.auth.login.config=\/opt\/zookeeper\/conf\/zookeeper-server-jaas.conf \\                              -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider \\                              -Dzookeeper.authProvider.2=org.apache.zookeeper.server.auth.SASLAuthenticationProvider \\                              -Dzookeeper.authProvider.3=org.apache.zookeeper.server.auth.SASLAuthenticationProvider \\                              -Dzookeeper.allowSaslFailedClients=false \\                              -Dzookeeper.sessionRequireClientSASLAuth=true\"  ExecStart=\/opt\/zookeeper\/bin\/zkServer.sh start \/opt\/zookeeper\/conf\/zookeeper.properties ExecStop=\/opt\/zookeeper\/bin\/zkServer.sh stop Restart=always   [Install] WantedBy=multi-user.target<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 SASL+SSL<\/h2>\n<p>\u0417\u0430\u0439\u0434\u0435\u043c \u0432 Zk \u0447\u0435\u0440\u0435\u0437 SSL+SASL \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e:<\/p>\n<pre><code>CLIENT_JVMFLAGS=\"-Djava.security.auth.login.config=\/opt\/zookeeper\/client-settings\/zookeeper-client-jaas.conf\"  export CLIENT_JVMFLAGS \/opt\/zookeeper\/bin\/zkCli.sh -server zoo1.local:2182,zoo2.local:2182,zoo3.local:2182 -client-configuration \/opt\/zookeeper\/client-settings\/zookeeper-client.properties ls \/<\/code><\/pre>\n<p>\u041c\u0435\u043d\u044f\u044f \u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c \u0432 \/opt\/zookeeper\/client-settings\/zookeeper-client-jaas.conf, \u043c\u044b \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 Zk \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c \u0432 zookeeper-client-jaas.conf \u043d\u0430 \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439, \u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043b\u043e\u043c\u0430\u0442\u044c\u0441\u044f. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 2181 \u0442\u043e\u0436\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<h2>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 ACL \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438?<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b zkCli \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043a Zk \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c bercut, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0443\u0437\u0435\u043b \/test:<\/p>\n<pre><code>ls \/ [zookeeper] create \/test create \/test\/1 set \/test\/1 123456<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u0440\u043d\u0435 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c:<\/p>\n<pre><code>getAcl  \/ 'world,'anyone     : cdrwa  getAcl \/test 'world,'anyone     : cdrwa<\/code><\/pre>\n<p>\u0411\u0443\u043a\u0432\u044b <strong>cdrwa<\/strong> \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442:<br \/> (<strong>c<\/strong>) <strong>C<\/strong>REATE: \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c child node;<br \/> (<strong>d<\/strong>) <strong>D<\/strong>ELETE: \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0443\u0437\u0435\u043b;<br \/> (<strong>r<\/strong>) <strong>R<\/strong>EAD: \u043c\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0443\u0437\u0435\u043b \u0438 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434\u0443\u0437\u043b\u044b;<br \/> (<strong>w<\/strong>) <strong>W<\/strong>RITE: \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u0443\u0437\u0435\u043b;<br \/> (<strong>a<\/strong>) <strong>A<\/strong>DMIN: \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0430.<\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0430\u0432\u0430. \u0417\u0430\u0431\u0435\u0440\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0430 \u0443 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u0440\u043e\u043c\u0435 bercut, \u043d\u0430 \u0443\u0437\u0435\u043b \/test:<\/p>\n<pre><code>setAcl \/test world:anyone:,sasl:bercut:cdrwa<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>getAcl \/test 'world,'anyone :  'sasl,'bercut : cdrwa  getAcl \/test\/1 'world,'anyone : cdrwa<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c test. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \/opt\/zookeeper\/client-settings\/zookeeper-client-jaas.conf:<\/p>\n<pre><code>Client {    org.apache.zookeeper.server.auth.DigestLoginModule required    username=\"test\"    password=\"ChangeMeSecretTUpass\"; };<\/code><\/pre>\n<p>\u041e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0437\u0435\u043b \/test:<\/p>\n<pre><code>ls \/   [test, zookeeper]  ls \/test Insufficient permission : \/test<\/code><\/pre>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c test \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0443\u0437\u0435\u043b \/test, ACL \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c super (super\/ChangeMeSecretSUpass), \u0442\u043e ACL \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443\u0442, \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e super \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0435, \u043e\u043d \u0436\u0435 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c:<\/p>\n<pre><code>ls \/     [test, zookeeper]  ls \/test     [1]  get \/test\/1 123456<\/code><\/pre>\n<h2>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433<\/h2>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0437\u0430\u043c\u0435\u0442\u0438\u043b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 metricsProvider.xxx. \u0414\u0430, \u044d\u0442\u043e \u043f\u0440\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433. \u0421\u0438\u043b\u044c\u043d\u043e \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044e\u0441\u044c \u0432 \u0442\u043e, \u043a\u0430\u043a, \u0447\u0442\u043e \u0438 \u0437\u0430\u0447\u0435\u043c &#8212;  \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0432\u0441\u0435 \u0436\u0435 \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/prometheus.io\" rel=\"noopener noreferrer nofollow\">Prometheus<\/a> \u0438 <a href=\"https:\/\/grafana.com\/\" rel=\"noopener noreferrer nofollow\">Grafana<\/a><\/p>\n<details class=\"spoiler\">\n<summary>prometheus.yml (\u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Prometheus)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"yaml\">rule_files:    - 'alerts\/alerts.zookeeper.yml' ... scrape_configs:   - job_name: 'zookeeper'     scrape_interval: 10s     scrape_timeout:  9s     metrics_path: \/metrics     file_sd_configs:       - files:         - 'inventory\/*.yml'     relabel_configs:       - source_labels: [jobs]               #pick up config if it has 'zookeeper' in comma-separated list in label 'jobs', drop if not         regex: '(.*,|^)zookeeper(,.*|$)'         action: keep       - regex: '^jobs$'                     #drop unused label 'jobs'         action: labeldrop       - source_labels: [__address__]        #save ip address into 'ip' label         regex: '(.*)(:.*)?'         replacement: '$1'         target_label: ip       - source_labels: [__address__]        #add port if it is absent in target, save ip:port to '__param_target' label         regex: (.*)         replacement: ${1}:8006         target_label: __param_target       - source_labels: [__param_target]     #copy '__param_target' label to 'instance' label          target_label: instance       - source_labels: [__param_target]     #copy '__param_target' label to '__address__' label         target_label: __address__ ...<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>inventory\/Bercut1.yml (\u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0437\u043b\u043e\u0432)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"yaml\">--- - targets:   - 192.168.1.11   labels:     jobs: \"node_exporter,blackbox-ssh,zookeeper\"     owner: \"habr\"     os: \"linux\"     hostname: \"zoo1.local\"     zooCluster: \"Bercut1\"     noAlarmOn: \"predict\" - targets:   - 192.168.1.12   labels:     jobs: \"node_exporter,blackbox-ssh,zookeeper\"     owner: \"habr\"     os: \"linux\"     hostname: \"zoo2.local\"     zooCluster: \"Bercut1\"     noAlarmOn: \"predict\" - targets:   - 192.168.1.13   labels:     jobs: \"node_exporter,blackbox-ssh,zookeeper\"     owner: \"habr\"     os: \"linux\"     hostname: \"zoo3.local\"     zooCluster: \"Bercut1\"     noAlarmOn: \"predict\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>alerts\/alerts.zookeeper.yml (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0430\u043b\u0435\u0440\u0442\u043e\u0432)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"yaml\">groups: - name: zk-alerts   rules:   - alert: ZooKeeper server is down     expr:  up{job=\"zookeeper\"} == 0     for: 1m     labels:       severity: critical     annotations:       summary: \"Instance {{ $labels.instance }} ZooKeeper server is down\"       description: \"{{ $labels.instance }} of job {{$labels.job}} ZooKeeper server is down: [{{ $value }}].\"    - alert: create too many znodes     expr: znode_count{job=\"zookeeper\"} > 1000000     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} create too many znodes\"       description: \"{{ $labels.instance }} of job {{$labels.job}} create too many znodes: [{{ $value }}].\"    - alert: create too many connections     expr: num_alive_connections{job=\"zookeeper\"} > 50 # suppose we use the default maxClientCnxns: 60     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} create too many connections\"       description: \"{{ $labels.instance }} of job {{$labels.job}} create too many connections: [{{ $value }}].\"    - alert: znode total occupied memory is too big     expr: approximate_data_size{job=\"zookeeper\"} \/1024 \/1024 > 1 * 1024 # more than 1024 MB(1 GB)     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} znode total occupied memory is too big\"       description: \"{{ $labels.instance }} of job {{$labels.job}} znode total occupied memory is too big: [{{ $value }}] MB.\"    - alert: set too many watch     expr: watch_count{job=\"zookeeper\"} > 10000     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} set too many watch\"       description: \"{{ $labels.instance }} of job {{$labels.job}} set too many watch: [{{ $value }}].\"    - alert: a leader election happens     expr: increase(election_time_count{job=\"zookeeper\"}[5m]) > 0     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} a leader election happens\"       description: \"{{ $labels.instance }} of job {{$labels.job}} a leader election happens: [{{ $value }}].\"    - alert: open too many files     expr: open_file_descriptor_count{job=\"zookeeper\"} > 300     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} open too many files\"       description: \"{{ $labels.instance }} of job {{$labels.job}} open too many files: [{{ $value }}].\"    - alert: fsync time is too long     expr: rate(fsynctime_sum{job=\"zookeeper\"}[1m]) > 100     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} fsync time is too long\"       description: \"{{ $labels.instance }} of job {{$labels.job}} fsync time is too long: [{{ $value }}].\"    - alert: take snapshot time is too long     expr: rate(snapshottime_sum{job=\"zookeeper\"}[5m]) > 100     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} take snapshot time is too long\"       description: \"{{ $labels.instance }} of job {{$labels.job}} take snapshot time is too long: [{{ $value }}].\"    - alert: avg latency is too high     expr: avg_latency{job=\"zookeeper\"} > 100     for: 1m     labels:       severity: warning     annotations:       summary: \"Instance {{ $labels.instance }} avg latency is too high\"       description: \"{{ $labels.instance }} of job {{$labels.job}} avg latency is too high: [{{ $value }}].\"    - alert: JvmMemoryFillingUp     expr: jvm_memory_bytes_used{job=\"zookeeper\"} \/ jvm_memory_bytes_max{area=\"heap\"} > 0.8     for: 5m     labels:       severity: warning     annotations:       summary: \"JVM memory filling up (instance {{ $labels.instance }})\"       description: \"JVM memory is filling up (> 80%)\\n labels: {{ $labels }}  value = {{ $value }}\\n\"<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Grafana default ZooKeeper dashboard<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/grafana.com\/grafana\/dashboards\/10465-zookeeper-by-prometheus\/\" rel=\"noopener noreferrer nofollow\">https:\/\/grafana.com\/grafana\/dashboards\/10465-zookeeper-by-prometheus\/<\/a><\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/details>\n<h2>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435<\/h2>\n<p>\u042f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Zookeeper. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0430\u043c \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u0441\u043a\u043e\u043c\u043a\u0430\u043d\u043e \u0438 \u0438\u0445 \u043f\u043e \u043a\u0443\u0441\u043e\u0447\u043a\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Zk. \u0410 \u043a\u043e\u0435-\u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u0430 StackOverflow \u0441 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u043c \u0431\u043b\u0443\u0436\u0434\u0430\u043d\u0438\u0435\u043c \u043f\u043e \u0442\u0438\u043a\u0435\u0442\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 Zk. <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0431\u044b\u043b\u043e \u0431\u044b \u043a\u043b\u0430\u0441\u0441\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 Ansible, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442, \u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0431\u044b \u043d\u0435 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/764512\/\"> https:\/\/habr.com\/ru\/articles\/764512\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0421\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c SSL \u0438 SASL \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 Linux \u0443\u0437\u043b\u043e\u0432 Zookeeper, \u0438 \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p> \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a: <\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Zookeeper \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0438\u0437 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u0431\u0435\u0437 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f (Plain);<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0438\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (Quorum TLS);<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0443\u0437\u043b\u0430\u043c Zookeeper \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 (Server TLS);<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043a \u0443\u0437\u043b\u0430\u043c (Client TLS);<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 (SASL with MD5);<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 ACL, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c super \u043e\u0442 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 (\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 ACL \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438).<\/p>\n<\/li>\n<\/ul>\n<h2>Plain<\/h2>\n<p>\u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f, \u043a\u0430\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0437\u0430 \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u043d\u0430\u0447\u043d\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u0435\u0435.<\/p>\n<p>\u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u0440\u0438 \u0443\u0437\u043b\u0430 \u0441 Linux, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 AlmaLinux 9.2.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0437\u043d\u0430\u043b\u0438 \u0441\u0432\u043e\u0438 \u0438\u043c\u0435\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c DNS, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0438\u0445 \u0438\u043c\u0435\u043d\u0430\u0445 \u0432 \/etc\/hosts \u043d\u0430 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u0430\u0445:<\/p>\n<pre><code>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.11 zoo1.local zoo1 192.168.1.12 zoo2.local zoo2  192.168.1.13 zoo3.local zoo3<\/code><\/pre>\n<p><strong>\u041d\u0438\u0436\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 hostname -f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0436\u043d\u043e, \u0432 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0438\u043c\u0435\u043d\u0430 \u0432 \/etc\/hosts (\u0441\u043d\u0430\u0447\u0430\u043b\u0430 zoo1.local, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c zoo1, \u043d\u043e \u043d\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442).<\/strong><\/p>\n<p>\u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Zookeeper(Zk) \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 JDK11 LTS (\u0432 \u0441\u043f\u0438\u0441\u043a\u0435 JDK 8 LTS, JDK 11 LTS, JDK 12 ), \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0451 \u043d\u0430 \u0432\u0441\u0435 \u0443\u0437\u043b\u044b:<\/p>\n<pre><code>sudo dnf install -y java-11-openjdk.x86_64<\/code><\/pre>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 Zk, \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u044f 3.8.3:<\/p>\n<pre><code>wget https:\/\/dlcdn.apache.org\/zookeeper\/stable\/apache-zookeeper-3.8.3-bin.tar.gz<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 Zk \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/dlcdn.apache.org\/zookeeper\/stable\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f zookeeper:<\/p>\n<pre><code>sudo useradd -m -d \/opt\/zookeeper -s \/bin\/bash zookeeper<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c, \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0448\u0435\u043b\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \/bin\/false. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043f\u0430\u043f\u043a\u0443 \/opt\/zookeeper. <\/p>\n<p>\u0420\u0430\u0441\u043f\u0430\u043a\u0443\u0435\u043c \u0432 \u043d\u0435\u0435 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432, \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code>sudo tar -xf apache-zookeeper-3.8.3-bin.tar.gz --directory \/opt\/zookeeper sudo chown -R zookeeper:zookeeper \/opt\/zookeeper sudo su - zookeeper mv apache-zookeeper-3.8.3-bin\/{bin,conf,lib,docs} .  rm -r apache-zookeeper-3.8.3-bin mkdir -m 700 ssl client-settings data .ssh<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u0444\u0430\u0439\u043b \/opt\/zookeeper\/conf\/zookeeper.properties:<\/p>\n<pre><code>dataDir=\/opt\/zookeeper\/data  # zoo cluster node info #server.id=hostname:port1:port2   # id - The ID of the Zookeeper cluster node.   # hostname - The hostname or IP address where the node listens for connections.   # port1 - The port number used for intra-cluster communication.   # port2 - The port number used for leader election. server.1=zoo1.local:2888:3888 server.2=zoo2.local:2888:3888 server.3=zoo3.local:2888:3888  ## Metrics Providers # https:\/\/prometheus.io Metrics Exporter metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider metricsProvider.httpHost=0.0.0.0 metricsProvider.httpPort=8006 metricsProvider.exportJvmInfo=true  # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial synchronization phase can take initLimit=10 # The number of ticks that can pass between sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored.   #max client connections number maxClientCnxns=60  # the port at which the clients will connect in plain text (it should be commented and disabled) clientPort=2181<\/code><\/pre>\n<p>\u0418 \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043d\u0430\u043f\u0438\u0448\u0435\u043c unit file \u0434\u043b\u044f systemd \/etc\/systemd\/system\/zookeeper.service. \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0430\u0436\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e JAVA_HOME, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e ZK_SERVER_HEAP \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043c HEAP \u043f\u0430\u043c\u044f\u0442\u044c:<\/p>\n<pre><code>exit sudo vim \/etc\/systemd\/system\/zookeeper.service<\/code><\/pre>\n<pre><code>[Unit] Description=Apache Zookeeper server Documentation=http:\/\/zookeeper.apache.org Requires=network.target remote-fs.target After=network.target remote-fs.target   [Service] Type=forking User=zookeeper Group=zookeeper  Environment=\"JAVA_HOME=\/usr\/lib\/jvm\/jre-11\"  #default heap size is 1000 Mb (set in zkEnv.sh) Environment=\"ZK_SERVER_HEAP=2000\"  ExecStart=\/opt\/zookeeper\/bin\/zkServer.sh start \/opt\/zookeeper\/conf\/zookeeper.properties ExecStop=\/opt\/zookeeper\/bin\/zkServer.sh stop Restart=always   [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0432\u044b\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0432\u0430\u0436\u043d\u043e \u0432 \u043f\u0430\u043f\u043a\u0435 data \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0443\u0437\u043b\u043e\u0432. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code>sudo su - zookeeper # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435  echo 1 > \/opt\/zookeeper\/data\/myid  # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0443\u0437\u043b\u0435 echo 2 > \/opt\/zookeeper\/data\/myid  # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0443\u0437\u043b\u0435 echo 3 > \/opt\/zookeeper\/data\/myid exit<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0447\u0438\u0442\u0430\u0435\u043c unit \u0444\u0430\u0439\u043b systemd, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u0441\u044f \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a Zk \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043d\u043e \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u043b\u043e\u0433 \u0444\u0430\u0439\u043b\u044b Zk:<\/p>\n<pre><code>sudo systemctl daemon-reload sudo systemctl enable --now zookeeper sudo systemctl status zookeeper --no-pager sudo su - zookeeper bin\/zkCli.sh -server 127.0.0.1:2181 ls \/zookeeper       #\u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443       #[config, quota] tail -f logs\/zookeeper-zookeeper-server-$(hostname -f).out<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0443\u0447\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0443\u0437\u043b\u044b \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443 \u2014 \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u044b \/opt\/zookeeper\/data\/myid \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440.<\/p>\n<h2>Quorum TLS<\/h2>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0435\u0440\u0438\u0438 \u043c\u044b \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0430\u043f\u043a\u0443 \/opt\/zookeeper\/ssl, \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043a\u043b\u044e\u0447\u0435\u0439. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. <\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \/opt\/zookeeper\/ssl, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u2014 Quorum-TLS-CA. \u0412 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c \u043a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430:<\/p>\n<pre><code>cd \/opt\/zookeeper\/ssl mkdir -m 700 Quorum-TLS-CA<\/code><\/pre>\n<p>\u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0443\u0437\u043b\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0435\u043c CA \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f Quorum, \u0441\u043e \u0441\u0440\u043e\u043a\u043e\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 10 \u043b\u0435\u0442:<\/p>\n<pre><code>openssl req -new -newkey rsa:4096 -days 3650 -x509 -subj \"\/CN=ZooKeeper-Security-CA\" -keyout Quorum-TLS-CA\/ca-key -out Quorum-TLS-CA\/ca-cert -nodes<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Quorum-TLS-CA\/ca-key \u0438 Quorum-TLS-CA\/ca-cert \u043d\u0430 \u0432\u0441\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u0437\u043b\u044b (\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 CA \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0437\u043b\u0435, \u043e\u043d \u043d\u0443\u0436\u0435\u043d \u043e\u0434\u0438\u043d):<\/p>\n<pre><code># \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435 ssh-keygen -C zookeeperKey -t ed25519 cat \/opt\/zookeeper\/.ssh\/id_ed25519.pub >> \/opt\/zookeeper\/.ssh\/authorized_keys chmod 600 \/opt\/zookeeper\/.ssh\/authorized_keys cat \/opt\/zookeeper\/.ssh\/id_ed25519     #\u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 cat \/opt\/zookeeper\/.ssh\/id_ed25519.pub     #\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447  # \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0438 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0443\u0437\u043b\u0435 mkdir .ssh vim \/opt\/zookeeper\/.ssh\/id_ed25519     #\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 vim \/opt\/zookeeper\/.ssh\/authorized_keys     #\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 chmod 600 \/opt\/zookeeper\/.ssh\/authorized_keys \/opt\/zookeeper\/.ssh\/id_ed25519  # \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0437\u043b\u0435 cd \/opt\/zookeeper\/ssl scp Quorum-TLS-CA\/* zoo2.local:\/opt\/zookeeper\/ssl\/Quorum-TLS-CA scp Quorum-TLS-CA\/* zoo3.local:\/opt\/zookeeper\/ssl\/Quorum-TLS-CA<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0432\u043e\u0440\u0443\u043c\u0430. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 key\/trust:<\/p>\n<pre><code>export QPASS=ChangeMeSecretQpass<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 (truststore) \u0434\u043b\u044f zookeeper-quorum, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 CA. \u0424\u0430\u0439\u043b \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f zookeeper-quorum.truststore.jks:<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.truststore.jks -alias CARoot -import -file Quorum-TLS-CA\/ca-cert -storepass $QPASS -keypass $QPASS -noprompt<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 (keystore) \u0434\u043b\u044f zookeeper-quorum. \u0422\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u0443\u0437\u043b\u0430, \u043f\u0440\u0435\u0434\u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0448\u0435\u043b\u043b\u0430 $(hostname -f) \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code>keytool -genkeypair -alias $(hostname -f) -keyalg RSA -keysize 2048 -dname \"cn=$(hostname -f)\" -keypass $QPASS -keystore zookeeper-quorum.keystore.jks -storepass $QPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u0435\u043c CSR (Certificate Signing Request) = \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0434\u0430\u0447\u0443 (\u043f\u043e\u0434\u043f\u0438\u0441\u044c) SSL \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430:<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.keystore.jks -alias $(hostname -f) -certreq -file ca-request-zookeeper-$(hostname -f) -storepass $QPASS -keypass $QPASS<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Quorum-TLS-CA\/ca-key \u0438 Quorum-TLS-CA\/ca-cert \u043d\u0430 \u0432\u0441\u0435 \u0443\u0437\u043b\u044b, \u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u044d\u0442\u0438\u0445 CSR, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0442\u0430\u043c, \u0433\u0434\u0435 \u0435\u0441\u0442\u044c CA.<\/p>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 ca-key \u0438 ca-cert \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430:<\/p>\n<pre><code>openssl x509 -req -CA Quorum-TLS-CA\/ca-cert -CAkey Quorum-TLS-CA\/ca-key -in ca-request-zookeeper-$(hostname -f) -out cert-zookeeper-$(hostname -f)-signed -days 3650 -CAcreateserial -passin pass:$QPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 CA \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 Zookeeper (keystore):<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.keystore.jks -import -file Quorum-TLS-CA\/ca-cert -storepass $QPASS -keypass $QPASS -noprompt -alias CARoot<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 Zookeeper \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 keystore:<\/p>\n<pre><code>keytool -keystore zookeeper-quorum.keystore.jks -import -file cert-zookeeper-$(hostname -f)-signed -storepass $QPASS -keypass $QPASS -alias $(hostname -f) -noprompt<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 zookeeper-quorum.keystore.jks \u0435\u0441\u0442\u044c CA \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u041e\u0414\u041d\u041e\u0413\u041e \u0443\u0437\u043b\u0430 (\u0442.\u0435. \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435):<\/p>\n<pre><code>keytool -list -v -keystore zookeeper-quorum.keystore.jks -storepass $QPASS<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b CSR, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 Zookeeper (\u043e\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u0432 keystore):<\/p>\n<pre><code>rm cert-zookeeper-*-signed  ca-request-zookeeper-* Quorum-TLS-CA\/ca-cert.srl<\/code><\/pre>\n<p>\u041d\u0430 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u0430\u0445 \u0432 \/opt\/zookeeper\/conf\/zookeeper.properties \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0438\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u041e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u0434\u043e \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044e: \u0440\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u0435\u0433\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 QPASS, \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0432\u0430\u0436\u0434\u044b.<\/p>\n<pre><code>#Quorum TLS sslQuorum=true  serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-356300","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356300","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=356300"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356300\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=356300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=356300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=356300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}