Package com.clickhouse.client
Class ClickHouseNode.Builder
java.lang.Object
com.clickhouse.client.ClickHouseNode.Builder
- Enclosing class:
- ClickHouseNode
Mutable and non-thread safe builder.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClickHouseCredentialsprotected Stringprotected Integerprotected ClickHouseProtocol -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an option for this node.address(ClickHouseProtocol protocol, InetSocketAddress address) Sets protocol and socket address.address(InetSocketAddress address) Sets socket address.Adds a tag for this node.build()Creates a new node.Sets cluster name.credentials(ClickHouseCredentials credentials) Sets credentials will be used when connecting to this node.Sets database name.protected ClickHouseCredentialsprotected StringgetHost()protected intgetPort()protected ClickHouseProtocolgetTags()Sets host name.Sets all options for this node.port(ClickHouseProtocol protocol) Sets protocol used by the port.port(ClickHouseProtocol protocol, Integer port) Sets protocol and port number.Sets port number.removeOption(String option) Removes an option from this node.Removes a tag from this node.Sets all tags for this node.tags(Collection<String> tags) Sets all tags for this node.Sets time zone of this node.Sets time zone of this node.version(ClickHouseVersion version) Sets vesion of this node.Sets vesion of this node.Sets weight of this node.
-
Field Details
-
host
-
protocol
-
port
-
credentials
-
options
-
tags
-
-
Constructor Details
-
Builder
protected Builder()Default constructor.
-
-
Method Details
-
getHost
-
getProtocol
-
getPort
protected int getPort() -
getCredentials
-
getOptions
-
getTags
-
cluster
Sets cluster name.- Parameters:
cluster- cluster name, null means no cluster name- Returns:
- this builder
-
host
Sets host name.- Parameters:
host- host name, null meansClickHouseDefaults.HOST- Returns:
- this builder
-
port
Sets port number.- Parameters:
port- port number, null means default port ofClickHouseDefaults.PROTOCOL- Returns:
- this builder
-
port
Sets protocol used by the port.- Parameters:
protocol- protocol, null meansClickHouseDefaults.PROTOCOL- Returns:
- this builder
-
port
Sets protocol and port number.- Parameters:
protocol- protocol, null meansClickHouseDefaults.PROTOCOLport- number, null means default port ofprotocol- Returns:
- this builder
-
address
Sets socket address.- Parameters:
address- socket address, null meansClickHouseDefaults.HOSTand default port ofClickHouseDefaults.PROTOCOL- Returns:
- this builder
-
address
Sets protocol and socket address.- Parameters:
protocol- protocol, null meansClickHouseDefaults.PROTOCOLaddress- socket address, null meansClickHouseDefaults.HOSTand default port ofprotocol- Returns:
- this builder
-
database
Sets database name.- Parameters:
database- database name, null meansClickHouseDefaults.DATABASE- Returns:
- this builder
-
credentials
Sets credentials will be used when connecting to this node. This is optional as client will useClickHouseConfig.getDefaultCredentials()to connect to all nodes.- Parameters:
credentials- credentials, null meansClickHouseConfig.getDefaultCredentials()- Returns:
- this builder
-
addOption
Adds an option for this node.- Parameters:
option- option name, null value will be ignoredvalue- option value- Returns:
- this builder
-
removeOption
Removes an option from this node.- Parameters:
option- option to be removed, null value will be ignored- Returns:
- this builder
-
options
Sets all options for this node. Use null or empty value to clear all existing options.- Parameters:
options- options for the node- Returns:
- this builder
-
addTag
Adds a tag for this node.- Parameters:
tag- tag for the node, null or duplicate tag will be ignored- Returns:
- this builder
-
removeTag
Removes a tag from this node.- Parameters:
tag- tag to be removed, null value will be ignored- Returns:
- this builder
-
tags
Sets all tags for this node. Use null or empty value to clear all existing tags.- Parameters:
tag- tag for the node, null will be ignoredmore- more tags for the node, null tag will be ignored- Returns:
- this builder
-
tags
Sets all tags for this node. Use null or empty value to clear all existing tags.- Parameters:
tags- list of tags for the node, null tag will be ignored- Returns:
- this builder
-
replica
-
shard
-
weight
Sets weight of this node.- Parameters:
weight- weight of the node, null means default weight- Returns:
- this builder
-
timeZone
Sets time zone of this node.- Parameters:
tz- time zone ID, could be null- Returns:
- this builder
-
timeZone
Sets time zone of this node.- Parameters:
tz- time zone, could be null- Returns:
- this builder
-
version
Sets vesion of this node.- Parameters:
version- version string, could be null- Returns:
- this builder
-
version
Sets vesion of this node.- Parameters:
version- version, could be null- Returns:
- this builder
-
build
Creates a new node.- Returns:
- new node
-