Skip to content

Commit

Permalink
Introduce multi host in pulsar doc (apache#4546)
Browse files Browse the repository at this point in the history
Pulsar already have been supported multi host. Introduce them in Pulsar document.
  • Loading branch information
zymap authored and jiazhai committed Jun 19, 2019
1 parent d1545bd commit 2e94523
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions site2/docs/admin-api-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
12 changes: 12 additions & 0 deletions site2/docs/client-libraries-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions site2/docs/deploy-bare-metal.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2e94523

Please sign in to comment.