Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure metadata store URL in functions_worker.yml #13782

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions conf/functions_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ workerHostname: localhost
workerPort: 6750
workerPortTls: 6751

# Configuration Store connection string
configurationStoreServers: localhost:2181
# The Configuration metadata store url
# Examples:
# * zk:my-zk-1:2181,my-zk-2:2181,my-zk-3:2181
# * my-zk-1:2181,my-zk-2:2181,my-zk-3:2181 (will default to ZooKeeper when the schema is not specified)
# * zk:my-zk-1:2181,my-zk-2:2181,my-zk-3:2181/my-chroot-path (to add a ZK chroot path)
configurationMetadataStoreUrl: zk:localhost:2181
# ZooKeeper session timeout in milliseconds
zooKeeperSessionTimeoutMillis: 30000
# ZooKeeper operation timeout in seconds
Expand Down Expand Up @@ -328,3 +332,6 @@ validateConnectorConfig: false
# Whether to initialize distributed log metadata by runtime.
# If it is set to true, you must ensure that it has been initialized by "bin/pulsar initialize-cluster-metadata" command.
initializedDlogMetadata: false

### --- Deprecated settings --- ###
configurationStoreServers: localhost:2181
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ public static WorkerConfig initializeWorkerConfigFromBrokerConfig(ServiceConfigu
workerConfig.setAuthenticationProviders(brokerConfig.getAuthenticationProviders());
workerConfig.setAuthorizationEnabled(brokerConfig.isAuthorizationEnabled());
workerConfig.setAuthorizationProvider(brokerConfig.getAuthorizationProvider());
workerConfig.setConfigurationStoreServers(brokerConfig.getConfigurationMetadataStoreUrl());
workerConfig.setConfigurationMetadataStoreUrl(brokerConfig.getConfigurationMetadataStoreUrl());
workerConfig.setZooKeeperSessionTimeoutMillis(brokerConfig.getZooKeeperSessionTimeoutMillis());
workerConfig.setZooKeeperOperationTimeoutSeconds(brokerConfig.getZooKeeperOperationTimeoutSeconds());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,17 @@ public class WorkerConfig implements Serializable, PulsarConfiguration {
@FieldContext(
category = CATEGORY_WORKER,
required = false,
deprecated = true,
doc = "Configuration store connection string (as a comma-separated list)"
)
@Deprecated
private String configurationStoreServers;
gaozhangmin marked this conversation as resolved.
Show resolved Hide resolved
@FieldContext(
category = CATEGORY_WORKER,
required = false,
doc = "Configuration store connection string (as a comma-separated list)"
)
private String configurationMetadataStoreUrl;
@FieldContext(
category = CATEGORY_WORKER,
doc = "ZooKeeper session timeout in milliseconds"
Expand Down Expand Up @@ -633,6 +641,14 @@ public static String unsafeLocalhostResolve() {
}
}

public String getConfigurationMetadataStoreUrl() {
if (StringUtils.isNotBlank(configurationMetadataStoreUrl)) {
return configurationMetadataStoreUrl;
} else {
return configurationStoreServers;
}
}

@Override
public void setProperties(Properties properties) {
this.properties = properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ private AuthorizationService getAuthorizationService() throws PulsarServerExcept

log.info("starting configuration cache service");
try {
configMetadataStore = PulsarResources.createMetadataStore(workerConfig.getConfigurationStoreServers(),
configMetadataStore = PulsarResources.createMetadataStore(
workerConfig.getConfigurationMetadataStoreUrl(),
(int) workerConfig.getZooKeeperSessionTimeoutMillis());
} catch (IOException e) {
throw new PulsarServerException(e);
Expand Down
2 changes: 1 addition & 1 deletion site2/docs/functions-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ For example, if you use token authentication, you need to configure the followin
```Yaml
clientAuthenticationPlugin: org.apache.pulsar.client.impl.auth.AuthenticationToken
clientAuthenticationParameters: file:///etc/pulsar/token/admin-token.txt
configurationStoreServers: zookeeper-cluster:2181 # auth requires a connection to zookeeper
configurationMetadataStoreUrl: zk:zookeeper-cluster:2181 # auth requires a connection to zookeeper
authenticationProviders:
- "org.apache.pulsar.broker.authentication.AuthenticationProviderToken"
authorizationEnabled: true
Expand Down
4 changes: 2 additions & 2 deletions site2/docs/functions-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ properties:

##### Enable Authorization Provider

To enable authorization on Functions Worker, you need to configure `authorizationEnabled`, `authorizationProvider` and `configurationStoreServers`. The authentication provider connects to `configurationStoreServers` to receive namespace policies.
To enable authorization on Functions Worker, you need to configure `authorizationEnabled`, `authorizationProvider` and `configurationMetadataStoreUrl`. The authentication provider connects to `configurationMetadataStoreUrl` to receive namespace policies.

```yaml
authorizationEnabled: true
authorizationProvider: org.apache.pulsar.broker.authorization.PulsarAuthorizationProvider
configurationStoreServers: <configuration-store-servers>
configurationMetadataStoreUrl: <meta-type>:<configuration-metadata-store-url>
```

You should also configure a list of superuser roles. The superuser roles are able to access any admin API. The following is a configuration example.
Expand Down
2 changes: 1 addition & 1 deletion site2/website-next/docs/functions-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ For example, if you use token authentication, you need to configure the followin

clientAuthenticationPlugin: org.apache.pulsar.client.impl.auth.AuthenticationToken
clientAuthenticationParameters: file:///etc/pulsar/token/admin-token.txt
configurationStoreServers: zookeeper-cluster:2181 # auth requires a connection to zookeeper
configurationMetadataStoreUrl: zk:zookeeper-cluster:2181 # auth requires a connection to zookeeper
authenticationProviders:
- "org.apache.pulsar.broker.authentication.AuthenticationProviderToken"
authorizationEnabled: true
Expand Down
4 changes: 2 additions & 2 deletions site2/website-next/docs/functions-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ properties:

##### Enable Authorization Provider

To enable authorization on Functions Worker, you need to configure `authorizationEnabled`, `authorizationProvider` and `configurationStoreServers`. The authentication provider connects to `configurationStoreServers` to receive namespace policies.
To enable authorization on Functions Worker, you need to configure `authorizationEnabled`, `authorizationProvider` and `configurationMetadataStoreUrl`. The authentication provider connects to `configurationMetadataStoreUrl` to receive namespace policies.

```yaml

authorizationEnabled: true
authorizationProvider: org.apache.pulsar.broker.authorization.PulsarAuthorizationProvider
configurationStoreServers: <configuration-store-servers>
configurationMetadataStoreUrl: <meta-type>:<configuration-metadata-store-url>

```

Expand Down