[GitHub] [zookeeper] hanm commented on a change in pull request #944: ZOOKEEPER-3388: Allow client port to support plaintext and encrypted …
hanm commented on a change in pull request #944: ZOOKEEPER-3388: Allow client port to support plaintext and encrypted … URL: https://github.com/apache/zookeeper/pull/944#discussion_r290112464 ## File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java ## @@ -63,16 +69,26 @@ import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.common.ClientX509Util; import org.apache.zookeeper.common.NettyUtils; +import org.apache.zookeeper.common.SSLContextAndOptions; import org.apache.zookeeper.common.X509Exception; import org.apache.zookeeper.common.X509Exception.SSLContextException; import org.apache.zookeeper.server.auth.ProviderRegistry; import org.apache.zookeeper.server.auth.X509AuthenticationProvider; +import org.apache.zookeeper.server.quorum.QuorumPeerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NettyServerCnxnFactory extends ServerCnxnFactory { private static final Logger LOG = LoggerFactory.getLogger(NettyServerCnxnFactory.class); +/** + * Allow client-server sockets to accept both SSL and plaintext connections + */ +public static final String PORT_UNIFICATION_KEY = "zookeeper.client.portUnification"; +private final boolean shouldUsePortUnification; + +private static final byte TLS_HANDSHAKE_RECORD_TYPE = 0x16; Review comment: might worth to add a comment here on this value (like a link to an RFC). This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] hanm commented on a change in pull request #944: ZOOKEEPER-3388: Allow client port to support plaintext and encrypted …
hanm commented on a change in pull request #944: ZOOKEEPER-3388: Allow client port to support plaintext and encrypted … URL: https://github.com/apache/zookeeper/pull/944#discussion_r290111854 ## File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxnFactory.java ## @@ -315,37 +428,47 @@ protected void initChannel(SocketChannel ch) throws Exception { this.bootstrap.validate(); } -private synchronized void initSSL(ChannelPipeline p) -throws X509Exception, KeyManagementException, NoSuchAlgorithmException { +private synchronized void initSSL(ChannelPipeline p, boolean supportPlaintext) +throws X509Exception, KeyManagementException, NoSuchAlgorithmException, SSLException { String authProviderProp = System.getProperty(x509Util.getSslAuthProviderProperty()); -SSLContext sslContext; if (authProviderProp == null) { -sslContext = x509Util.getDefaultSSLContext(); +SSLContextAndOptions sslContextAndOptions = x509Util.getDefaultSSLContextAndOptions(); +SslContext nettySslContext = sslContextAndOptions.createNettyJdkSslContext( +sslContextAndOptions.getSSLContext(), false); + +if (supportPlaintext) { +p.addLast("ssl", new DualModeSslHandler(nettySslContext)); +LOG.debug("dual mode Java SSL handler added for channel: {}", p.channel()); +} else { +p.addLast("ssl", nettySslContext.newHandler(p.channel().alloc())); +LOG.debug("Java SSL handler added for channel: {}", p.channel()); +} } else { -sslContext = SSLContext.getInstance("TLSv1"); +SSLContext sslContext = SSLContext.getInstance(ClientX509Util.DEFAULT_PROTOCOL); X509AuthenticationProvider authProvider = -(X509AuthenticationProvider)ProviderRegistry.getProvider( +(X509AuthenticationProvider) ProviderRegistry.getProvider( System.getProperty(x509Util.getSslAuthProviderProperty(), "x509")); -if (authProvider == null) -{ +if (authProvider == null) { LOG.error("Auth provider not found: {}", authProviderProp); throw new SSLContextException( "Could not create SSLContext with specified auth provider: " + -authProviderProp); +authProviderProp); } -sslContext.init(new X509KeyManager[] { authProvider.getKeyManager() }, -new X509TrustManager[] { authProvider.getTrustManager() }, -null); +sslContext.init(new X509KeyManager[]{authProvider.getKeyManager()}, +new X509TrustManager[]{authProvider.getTrustManager()}, +null); +SslContext nettySslContext = x509Util.getDefaultSSLContextAndOptions() +.createNettyJdkSslContext(sslContext,false); +if (supportPlaintext) { Review comment: This looks like a duplicate of previous `if (supportPlaintext)` on L439, we can unify them to avoid code duplication. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] maoling commented on issue #960: Fix typos and grammar in zookeeper docs
maoling commented on issue #960: Fix typos and grammar in zookeeper docs URL: https://github.com/apache/zookeeper/pull/960#issuecomment-498483418 retest this please This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] enixon commented on issue #939: ZOOKEEPER-3385: Add admin command to display leader
enixon commented on issue #939: ZOOKEEPER-3385: Add admin command to display leader URL: https://github.com/apache/zookeeper/pull/939#issuecomment-498457960 retest maven build This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] asfgit closed pull request #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
asfgit closed pull request #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] vladimirivic commented on a change in pull request #953: ZOOKEEPER-3398 Learner.connectToLeader() may take too long to time-out
vladimirivic commented on a change in pull request #953: ZOOKEEPER-3398 Learner.connectToLeader() may take too long to time-out URL: https://github.com/apache/zookeeper/pull/953#discussion_r289949284 ## File path: conf/zoo_sample.cfg ## @@ -6,6 +6,9 @@ initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 +# The number of ticks that followers can take +# to connect to the leader after leader election +connectToLeaderLimit=5 Review comment: I will update the pull request to reflect the suggested changes. I will be renaming connectToLeaderLimit to connectToLearnerMasterLimit This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498341300 retest maven build This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498282034 @nkalmar the error seems not related to this patch ``` java.lang.AssertionError at org.junit.Assert.fail(Assert.java:86) at org.junit.Assert.assertTrue(Assert.java:41) at org.junit.Assert.assertTrue(Assert.java:52) at org.apache.zookeeper.server.quorum.QuorumPeerMainTest.testLeaderOutOfView(QuorumPeerMainTest.java:973) ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498282085 retest maven build This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498239868 I'm not sure why the maven build failed the last run? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498194477 Actually, I do have some javadoc warnings left :( `[WARNING] Javadoc Warnings [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/ServerCnxn.java:367: warning - Tag @see: missing '#': "dumpConnectionInfo(PrintWriter, boolean) for brief stats" [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZKDatabase.java:489: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnLog.java:312: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java:509: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/SnapStream.java:222: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/Util.java:257: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/Util.java:267: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java:80: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java:1117: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerMaster.java:74: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java:246: warning - @param argument "qv," is not a parameter name. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java:889: warning - @param argument "zxid," is not a parameter name. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java:889: warning - @param argument "sid," is not a parameter name. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java:1048: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java:1767: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/cli/AclParser.java:36: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/cli/CliCommand.java:75: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/cli/CliCommand.java:83: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/cli/CliCommand.java:91: warning - @return tag has no arguments. [WARNING] /Users/norbertkalmar/workspace/upstream/zookeeper2/zookeeper/zookeeper-server/src/main/java/org/apache/zookeeper/cli/CliCommand.java:116: warning - @return tag has no arguments.` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498191954 That's strange indeed. I can see it and it causes build failure. I checked out master and applied your patch (although it doesn't even touch that class). This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498192940 I had an old version of "master" locally. Thank you very much @nkalmar for your support. I have pushed the fix. Maybe I will have to iterate again if the rebase imported new javadoc errors This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498191594 Oh, maybe I have to rebase :-( This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498190929 @nkalmar this is weird here on github I can see the line, but I can't see that line on my local copy https://github.com/apache/zookeeper/blob/d3dbe787f37eb9e17402e4a3d55a441ca43b2160/zookeeper-server/src/main/java/org/apache/zookeeper/server/SyncRequestProcessor.java#L126 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498191055 ``` /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.zookeeper.server; import java.io.Flushable; import java.io.IOException; import java.util.ArrayDeque; import java.util.Objects; import java.util.Queue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.Semaphore; import java.util.concurrent.ThreadLocalRandom; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This RequestProcessor logs requests to disk. It batches the requests to do * the io efficiently. The request is not passed to the next RequestProcessor * until its log has been synced to disk. * * SyncRequestProcessor is used in 3 different cases * 1. Leader - Sync request to disk and forward it to AckRequestProcessor which * send ack back to itself. * 2. Follower - Sync request to disk and forward request to * SendAckRequestProcessor which send the packets to leader. * SendAckRequestProcessor is flushable which allow us to force * push packets to leader. * 3. Observer - Sync committed request to disk (received as INFORM packet). * It never send ack back to the leader, so the nextProcessor will * be null. This change the semantic of txnlog on the observer * since it only contains committed txns. */ public class SyncRequestProcessor extends ZooKeeperCriticalThread implements RequestProcessor { private static final Logger LOG = LoggerFactory.getLogger(SyncRequestProcessor.class); private static final int FLUSH_SIZE = 1000; private static final Request REQUEST_OF_DEATH = Request.requestOfDeath; /** The number of log entries to log before starting a snapshot */ private static int snapCount = ZooKeeperServer.getSnapCount(); /** * The total size of log entries before starting a snapshot */ private static long snapSizeInBytes = ZooKeeperServer.getSnapSizeInBytes(); /** * Random numbers used to vary snapshot timing */ private int randRoll; private long randSize; private final BlockingQueue queuedRequests = new LinkedBlockingQueue(); private final Semaphore snapThreadMutex = new Semaphore(1); private final ZooKeeperServer zks; private final RequestProcessor nextProcessor; /** * Transactions that have been written and are waiting to be flushed to * disk. Basically this is the list of SyncItems whose callbacks will be * invoked after flush returns successfully. */ private final Queue toFlush = new ArrayDeque<>(FLUSH_SIZE); public SyncRequestProcessor(ZooKeeperServer zks, RequestProcessor nextProcessor) { super("SyncThread:" + zks.getServerId(), zks .getZooKeeperServerListener()); this.zks = zks; this.nextProcessor = nextProcessor; } /** * used by tests to check for changing * snapcounts * @param count */ public static void setSnapCount(int count) { snapCount = count; } /** * used by tests to get the snapcount * @return the snapcount */ public static int getSnapCount() { return snapCount; } /** * used by tests to check for changing * snapcounts * @param size */ public static void setSnapSizeInBytes(long size) { snapSizeInBytes = size; } private boolean shouldSnapshot() { int logCount = zks.getZKDatabase().getTxnCount(); long logSize = zks.getZKDatabase().getTxnSize(); return (logCount > (snapCount / 2 + randRoll)) ||
[GitHub] [zookeeper] nkalmar edited a comment on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
nkalmar edited a comment on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498188536 Why not just remove the > sign and use "bigger" on the line "If both flushDelay and maxMaxBatchSize are set (> 0)" ? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
eolivelli commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498190223 > Why not just remove the > sign and use "bigger" on the line > "If both flushDelay and maxMaxBatchSize are set (> 0)" ? @nkalmar thankyou for helping out in which file ? I can't find the line you are referring to with a `grep -r "maxMaxBatchSize"` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] nkalmar edited a comment on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
nkalmar edited a comment on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498188536 Why not just remove the > sign and use "bigger" on the line "If both flushDelay and maxMaxBatchSize are set (> 0)" ? Edit - I got the same error locally when building. Fixed it by removing the greater sign. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint
nkalmar commented on issue #965: ZOOKEEPER-3409 Compile Java code with -Xdoclint URL: https://github.com/apache/zookeeper/pull/965#issuecomment-498188536 Why not just remove the > sing and use "smaller" on the line "If both flushDelay and maxMaxBatchSize are set (> 0)" ? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] maoling commented on a change in pull request #833: ZOOKEEPER-3288:add a new doc:ZookeeperCLI.md
maoling commented on a change in pull request #833: ZOOKEEPER-3288:add a new doc:ZookeeperCLI.md URL: https://github.com/apache/zookeeper/pull/833#discussion_r289740854 ## File path: zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md ## @@ -0,0 +1,542 @@ + + +# ZooKeeper-cli: the ZooKeeper command line interface + +## Pre-requisites +Enter into the ZooKeeper-cli + +```bash +# connect to the localhost with the default port:2181 +bin/zkCli.sh +# connect to the remote host with timeout:3s +bin/zkCli.sh -timeout 3000 -server remoteIP:2181 +``` +## help +Showing helps about ZooKeeper commands + +```bash +[zkshell: 1] help +# a sample one +[zkshell: 2] h +ZooKeeper -server host:port cmd args + addauth scheme auth + close + config [-c] [-w] [-s] + connect host:port + create [-s] [-e] [-c] [-t ttl] path [data] [acl] + delete [-v version] path + deleteall path + delquota [-n|-b] path + get [-s] [-w] path + getAcl [-s] path + getAllChildrenNumber path + getEphemerals path + history + listquota path + ls [-s] [-w] [-R] path + ls2 path [watch] + printwatches on|off + quit + reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*] + redo cmdno + removewatches path [-c|-d|-a] [-l] + rmr path + set [-s] [-v version] path data + setAcl [-s] [-v version] [-R] path acl + setquota -n|-b val path + stat [-w] path + sync path +``` + +## addauth +Add a authorized user for ACL + +```bash +[zkshell: 9] getAcl /acl_digest_test +Authentication is not valid : /acl_digest_test +[zkshell: 10] addauth digest user1:12345 +[zkshell: 11] getAcl /acl_digest_test +'digest,'user1:+owfoSBn/am19roBPzR1/MfCblE= +: cdrwa +# add a super user +# Notice:set zookeeper.DigestAuthenticationProvider +# e.g. zookeeper.DigestAuthenticationProvider.superDigest=zookeeper:qW/HnTfCSoQpB5G8LgkwT3IbiFc= +[zkshell: 12] addauth digest zookeeper:admin +``` + +## close +Close this client/session. + +```bash +[zkshell: 0] close + 2019-03-09 06:42:22,178 [myid:] - INFO [main-EventThread:ClientCnxn$EventThread@528] - EventThread shut down for session: 0x10007ab7c550006 + 2019-03-09 06:42:22,179 [myid:] - INFO [main:ZooKeeper@1346] - Session: 0x10007ab7c550006 closed +``` + +## config +Showing the config of quorum membership + +```bash +[zkshell: 17] config + server.1=[2001:db8:1:0:0:242:ac11:2]:2888:3888:participant + server.2=[2001:db8:1:0:0:242:ac11:2]:12888:13888:participant + server.3=[2001:db8:1:0:0:242:ac11:2]:22888:23888:participant + version=0 +``` +## connect +Connect a ZooKeeper server. + +```bash +[zkshell: 4] connect + 2019-03-09 06:43:33,179 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@986] - Socket connection established, initiating session, client: /127.0.0.1:35144, server: localhost/127.0.0.1:2181 + 2019-03-09 06:43:33,189 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1421] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x10007ab7c550007, negotiated timeout = 3 + connect "localhost:2181,localhost:2182,localhost:2183" + +# connect a remote server +[zkshell: 5] connect remoteIP:2181 +``` +## create +Create a znode. + +```bash +# create a persistent_node +[zkshell: 7] create /persistent_node + Created /persistent_node + +# create a ephemeral node +[zkshell: 8] create -e /ephemeral_node mydata + Created /ephemeral_node + +# create the persistent-sequential node +[zkshell: 9] create -s /persistent_sequential_node mydata + Created /persistent_sequential_node000176 + +# create the ephemeral-sequential_node +[zkshell: 10] create -s -e /ephemeral_sequential_node mydata + Created /ephemeral_sequential_node000174 + +# create a node with the schema +[zkshell: 11] create /zk-node-create-schema mydata digest:user1:+owfoSBn/am19roBPzR1/MfCblE=:crwad + Created /zk-node-create-schema +[zkshell: 12] addauth digest user1:12345 +[zkshell: 13] getAcl /zk-node-create-schema + 'digest,'user1:+owfoSBn/am19roBPzR1/MfCblE= + : cdrwa + +# create the container node.When the last child of a container is deleted,the container becomes to be deleted +[zkshell: 14] create -c /container_node mydata + Created /container_node +[zkshell: 15] create -c /container_node/child_1 mydata + Created /container_node/child_1 +[zkshell: 16] create -c /container_node/child_2 mydata + Created /container_node/child_2 +[zkshell: 17] delete /container_node/child_1 +[zkshell: 18] delete /container_node/child_2 +[zkshell: 19] get /container_node + org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for
[GitHub] [zookeeper] grgrzybek commented on issue #945: [ZOOKEEPER-3389] Zookeeper does not export all required packages in OSGi (needed for curator)
grgrzybek commented on issue #945: [ZOOKEEPER-3389] Zookeeper does not export all required packages in OSGi (needed for curator) URL: https://github.com/apache/zookeeper/pull/945#issuecomment-498168041 Excuse me for being late to the party. Let me introduce myself - I'm OSGi dinosaur and I'd be happy to help here. So `zookeeper-jute` jar contains (generated from `zookeeper-jute/src/main/resources/zookeeper.jute`) these packages: * org.apache.zookeeper.data * org.apache.zookeeper.proto * org.apache.zookeeper.server.quorum * org.apache.zookeeper.server.persistence * org.apache.zookeeper.txn `org.apache.zookeeper.data` is fine there, but `org.apache.zookeeper.server.quorum` and `org.apache.zookeeper.server.persistence` are duplicated in `zookeeper` jar, thus simple _OSGIfication_ of `zookeeper` + `zookeeper-jute` is not possible (can't have single package exported from two OSGi bundles. I mean it's possible, but may lead to unpredictable results - you can't tell which package your _importing_ bundle will _wire_ to). I understand that some classes of `org.apache.zookeeper.server.quorum` are written and some are generated from `zookeeper.jute` and it's fine in _flat classpath_ scenario. For OSGi, you'd have to do what for example Hibernate or httpclient (before silently dropping OSGi support in httpclient 5) is doing - there should be zookeeper-osgi.jar which just embeds both zookeeper and zookeeper-jute. This is best approach, because there'll be only one Maven artifact with `bundle`. I'll continue checking. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [zookeeper] eolivelli commented on a change in pull request #833: ZOOKEEPER-3288:add a new doc:ZookeeperCLI.md
eolivelli commented on a change in pull request #833: ZOOKEEPER-3288:add a new doc:ZookeeperCLI.md URL: https://github.com/apache/zookeeper/pull/833#discussion_r289702767 ## File path: zookeeper-docs/src/main/resources/markdown/zookeeperCLI.md ## @@ -0,0 +1,542 @@ + + +# ZooKeeper-cli: the ZooKeeper command line interface + +## Pre-requisites +Enter into the ZooKeeper-cli + +```bash +# connect to the localhost with the default port:2181 +bin/zkCli.sh +# connect to the remote host with timeout:3s +bin/zkCli.sh -timeout 3000 -server remoteIP:2181 +``` +## help +Showing helps about ZooKeeper commands + +```bash +[zkshell: 1] help +# a sample one +[zkshell: 2] h +ZooKeeper -server host:port cmd args + addauth scheme auth + close + config [-c] [-w] [-s] + connect host:port + create [-s] [-e] [-c] [-t ttl] path [data] [acl] + delete [-v version] path + deleteall path + delquota [-n|-b] path + get [-s] [-w] path + getAcl [-s] path + getAllChildrenNumber path + getEphemerals path + history + listquota path + ls [-s] [-w] [-R] path + ls2 path [watch] + printwatches on|off + quit + reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*] + redo cmdno + removewatches path [-c|-d|-a] [-l] + rmr path + set [-s] [-v version] path data + setAcl [-s] [-v version] [-R] path acl + setquota -n|-b val path + stat [-w] path + sync path +``` + +## addauth +Add a authorized user for ACL + +```bash +[zkshell: 9] getAcl /acl_digest_test +Authentication is not valid : /acl_digest_test +[zkshell: 10] addauth digest user1:12345 +[zkshell: 11] getAcl /acl_digest_test +'digest,'user1:+owfoSBn/am19roBPzR1/MfCblE= +: cdrwa +# add a super user +# Notice:set zookeeper.DigestAuthenticationProvider +# e.g. zookeeper.DigestAuthenticationProvider.superDigest=zookeeper:qW/HnTfCSoQpB5G8LgkwT3IbiFc= +[zkshell: 12] addauth digest zookeeper:admin +``` + +## close +Close this client/session. + +```bash +[zkshell: 0] close + 2019-03-09 06:42:22,178 [myid:] - INFO [main-EventThread:ClientCnxn$EventThread@528] - EventThread shut down for session: 0x10007ab7c550006 + 2019-03-09 06:42:22,179 [myid:] - INFO [main:ZooKeeper@1346] - Session: 0x10007ab7c550006 closed +``` + +## config +Showing the config of quorum membership + +```bash +[zkshell: 17] config + server.1=[2001:db8:1:0:0:242:ac11:2]:2888:3888:participant + server.2=[2001:db8:1:0:0:242:ac11:2]:12888:13888:participant + server.3=[2001:db8:1:0:0:242:ac11:2]:22888:23888:participant + version=0 +``` +## connect +Connect a ZooKeeper server. + +```bash +[zkshell: 4] connect + 2019-03-09 06:43:33,179 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@986] - Socket connection established, initiating session, client: /127.0.0.1:35144, server: localhost/127.0.0.1:2181 + 2019-03-09 06:43:33,189 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1421] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x10007ab7c550007, negotiated timeout = 3 + connect "localhost:2181,localhost:2182,localhost:2183" + +# connect a remote server +[zkshell: 5] connect remoteIP:2181 +``` +## create +Create a znode. + +```bash +# create a persistent_node +[zkshell: 7] create /persistent_node + Created /persistent_node + +# create a ephemeral node +[zkshell: 8] create -e /ephemeral_node mydata + Created /ephemeral_node + +# create the persistent-sequential node +[zkshell: 9] create -s /persistent_sequential_node mydata + Created /persistent_sequential_node000176 + +# create the ephemeral-sequential_node +[zkshell: 10] create -s -e /ephemeral_sequential_node mydata + Created /ephemeral_sequential_node000174 + +# create a node with the schema +[zkshell: 11] create /zk-node-create-schema mydata digest:user1:+owfoSBn/am19roBPzR1/MfCblE=:crwad + Created /zk-node-create-schema +[zkshell: 12] addauth digest user1:12345 +[zkshell: 13] getAcl /zk-node-create-schema + 'digest,'user1:+owfoSBn/am19roBPzR1/MfCblE= + : cdrwa + +# create the container node.When the last child of a container is deleted,the container becomes to be deleted +[zkshell: 14] create -c /container_node mydata + Created /container_node +[zkshell: 15] create -c /container_node/child_1 mydata + Created /container_node/child_1 +[zkshell: 16] create -c /container_node/child_2 mydata + Created /container_node/child_2 +[zkshell: 17] delete /container_node/child_1 +[zkshell: 18] delete /container_node/child_2 +[zkshell: 19] get /container_node + org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for