Skip to content

Commit

Permalink
Separate ports used by global and local zookeeper (apache#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
massakam authored and merlimat committed Nov 6, 2017
1 parent c86acea commit 9433f36
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ elif [ $COMMAND == "global-zookeeper" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"global-zookeeper.log"}
# Allow global ZK to turn into read-only mode when it cannot reach the quorum
OPTS="${OPTS} -Dreadonlymode.enabled=true"
exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.zookeeper.ZooKeeperStarter $PULSAR_GLOBAL_ZK_CONF $@
exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.zookeeper.GlobalZooKeeperStarter $PULSAR_GLOBAL_ZK_CONF $@
elif [ $COMMAND == "discovery" ]; then
PULSAR_LOG_FILE=${PULSAR_LOG_FILE:-"discovery.log"}
exec $JAVA $OPTS -Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.discovery.service.server.DiscoveryServiceStarter $PULSAR_DISCOVERY_CONF $@
Expand Down
2 changes: 1 addition & 1 deletion conf/bkenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ BOOKIE_MEM=" -Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g"
BOOKIE_GC=" -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB"

# Extra options to be passed to the jvm
BOOKIE_EXTRA_OPTS="${BOOKIE_MEM} ${BOOKIE_GC} -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"
BOOKIE_EXTRA_OPTS="${BOOKIE_EXTRA_OPTS} ${BOOKIE_MEM} ${BOOKIE_GC} -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"

# Add extra paths to the bookkeeper classpath
# BOOKIE_EXTRA_CLASSPATH=
Expand Down
2 changes: 1 addition & 1 deletion conf/pulsar_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PULSAR_MEM=" -Xms2g -Xmx2g -XX:MaxDirectMemorySize=4g"
PULSAR_GC=" -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB"

# Extra options to be passed to the jvm
PULSAR_EXTRA_OPTS="${PULSAR_MEM} ${PULSAR_GC} -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"
PULSAR_EXTRA_OPTS="${PULSAR_EXTRA_OPTS} ${PULSAR_MEM} ${PULSAR_GC} -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"

# Add extra paths to the bookkeeper classpath
# PULSAR_EXTRA_CLASSPATH=
Expand Down
2 changes: 1 addition & 1 deletion conf/pulsar_tools_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PULSAR_MEM=" -Xmx256m -XX:MaxDirectMemorySize=256m"
PULSAR_GC=" -client "

# Extra options to be passed to the jvm
PULSAR_EXTRA_OPTS="${PULSAR_MEM} ${PULSAR_GC} -Dio.netty.leakDetectionLevel=disabled"
PULSAR_EXTRA_OPTS="${PULSAR_EXTRA_OPTS} ${PULSAR_MEM} ${PULSAR_GC} -Dio.netty.leakDetectionLevel=disabled"

# Add extra paths to the bookkeeper classpath
# PULSAR_EXTRA_CLASSPATH=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* 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.pulsar.zookeeper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GlobalZooKeeperStarter extends ZooKeeperStarter {
public static void main(String[] args) throws Exception {
start(args, "8001");
}

private static final Logger log = LoggerFactory.getLogger(GlobalZooKeeperStarter.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,18 @@

public class ZooKeeperStarter {
public static void main(String[] args) throws Exception {
start(args, "8000");
}

protected static void start(String[] args, String defaultStatsPort) throws Exception {
// Register basic JVM metrics
DefaultExports.initialize();

// load aspectj-weaver agent for instrumentation
AgentLoader.loadAgentClass(Agent.class.getName(), null);

// Start Jetty to serve stats
int port = Integer.parseInt(System.getProperties().getProperty("stats_server_port", "8080"));
int port = Integer.parseInt(System.getProperties().getProperty("stats_server_port", defaultStatsPort));

log.info("Starting ZK stats HTTP server at port {}", port);
InetSocketAddress httpEndpoint = InetSocketAddress.createUnresolved("0.0.0.0", port);
Expand Down
8 changes: 6 additions & 2 deletions site/docs/latest/deployment/Monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ http://$BROKER_ADDRESS:8080/metrics

### ZooKeeper stats

The ZooKeeper server and clients that are shipped with Pulsar have been instrumented to expose
The local/global ZooKeeper server and clients that are shipped with Pulsar have been instrumented to expose
detailed stats through Prometheus as well.

```shell
http://$ZK_SERVER:8080/metrics
http://$LOCAL_ZK_SERVER:8000/metrics
http://$GLOBAL_ZK_SERVER:8001/metrics
```

The default port of local ZooKeeper is `8000` and that of global ZooKeeper is `8001`.
These can be changed by specifying system property `stats_server_port`.

### BookKeeper stats

For BookKeeper you can configure the stats frameworks by changing the `statsProviderClass` in
Expand Down

0 comments on commit 9433f36

Please sign in to comment.