You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zh...@apache.org on 2019/06/19 02:44:53 UTC

[pulsar] branch master updated: Introduce multi host in pulsar doc (#4546)

This is an automated email from the ASF dual-hosted git repository.

zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e94523  Introduce multi host in pulsar doc (#4546)
2e94523 is described below

commit 2e9452363fd53ece33bddde43c5655bd63d09d8a
Author: Yong Zhang <zh...@gmail.com>
AuthorDate: Wed Jun 19 10:44:48 2019 +0800

    Introduce multi host in pulsar doc (#4546)
    
    Pulsar already have been supported multi host. Introduce them in Pulsar document.
---
 site2/docs/admin-api-overview.md    | 20 ++++++++++++++++++++
 site2/docs/client-libraries-java.md | 12 ++++++++++++
 site2/docs/deploy-bare-metal.md     |  2 ++
 3 files changed, 34 insertions(+)

diff --git a/site2/docs/admin-api-overview.md b/site2/docs/admin-api-overview.md
index 7b48c86..df12d3e 100644
--- a/site2/docs/admin-api-overview.md
+++ b/site2/docs/admin-api-overview.md
@@ -70,3 +70,23 @@ config.setTlsTrustCertsFilePath(tlsTrustCertsFilePath);
 
 PulsarAdmin admin = new PulsarAdmin(url, config);
 ```
+
+If you have multiple brokers to use, you can use multi-host like Pulsar service. For example,
+```java
+URL url = new URL("http://localhost:8080,localhost:8081,localhost:8082");
+// Pass auth-plugin class fully-qualified name if Pulsar-security is enabled.
+String authPluginClassName = "com.org.MyAuthPluginClass"; 
+// Pass auth-param if auth-plugin class requires it
+String authParams = "param1=value1";
+boolean useTls = false;
+boolean tlsAllowInsecureConnection = false;
+String tlsTrustCertsFilePath = null;
+
+ClientConfiguration config = new ClientConfiguration();
+config.setAuthentication(authPluginClassName, authParams);
+config.setUseTls(useTls);
+config.setTlsAllowInsecureConnection(tlsAllowInsecureConnection);
+config.setTlsTrustCertsFilePath(tlsTrustCertsFilePath);
+
+PulsarAdmin admin = new PulsarAdmin(url, config);
+```
diff --git a/site2/docs/client-libraries-java.md b/site2/docs/client-libraries-java.md
index 4c4261f..2a07981 100644
--- a/site2/docs/client-libraries-java.md
+++ b/site2/docs/client-libraries-java.md
@@ -57,6 +57,11 @@ Pulsar protocol URLs are assigned to specific clusters, use the `pulsar` scheme
 pulsar://localhost:6650
 ```
 
+If you have more than one broker, the URL may look like this:
+```http
+pulsar://localhost:6550,localhost:6651,localhost:6652
+```
+
 A URL for a production Pulsar cluster may look something like this:
 
 ```http
@@ -79,6 +84,13 @@ PulsarClient client = PulsarClient.builder()
         .build();
 ```
 
+If you have multiple brokers, you can initiate a PulsarClient like this:
+```java
+PulsarClient client = PulsarClient.builder()
+        .serviceUrl("pulsar://localhost:6650,localhost:6651,localhost:6652")
+        .build();
+```
+
 > #### Default broker URLs for standalone clusters
 > If you're running a cluster in [standalone mode](getting-started-standalone.md), the broker will be available at the `pulsar://localhost:6650` URL by default.
 
diff --git a/site2/docs/deploy-bare-metal.md b/site2/docs/deploy-bare-metal.md
index 7a69227..6ed6a77 100644
--- a/site2/docs/deploy-bare-metal.md
+++ b/site2/docs/deploy-bare-metal.md
@@ -43,6 +43,8 @@ To run Pulsar on bare metal, you are recommended to have:
 > However if you don't have enough machines, or are trying out Pulsar in cluster mode (and expand the cluster later),
 > you can even deploy Pulsar in one node, where it will run zookeeper, bookie and broker in same machine.
 
+> If you don't have a DNS server, you can use multi-host in service URL instead.
+
 Each machine in your cluster will need to have [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or higher installed.
 
 Here's a diagram showing the basic setup: