public class DbBackendConfig extends Object implements Serializable
DbStateBackend
, containing information to
shard and connect to the databases that will store the state checkpoints.Constructor and Description |
---|
DbBackendConfig(String dbUserName,
String dbUserPassword,
List<String> dbShardUrls)
Creates a new sharded database state backend configuration with the given
parameters and default
MySqlAdapter . |
DbBackendConfig(String dbUserName,
String dbUserPassword,
String dbUrl)
Creates a new database state backend configuration with the given
parameters and default
MySqlAdapter . |
Modifier and Type | Method and Description |
---|---|
ShardedConnection |
createShardedConnection()
Creates a new
ShardedConnection using the set parameters. |
DbAdapter |
getDbAdapter()
Get the
DbAdapter that will be used to operate on the database
during checkpointing. |
String |
getJDBCDriver()
The class name that should be used to load the JDBC driver using
Class.forName(JDBCDriverClass).
|
int |
getKvCacheSize()
The maximum number of key-value pairs stored in one task instance's cache
before evicting to the underlying database.
|
int |
getKvStateCompactionFrequency()
Sets how often will automatic compaction be performed on the database to
remove old overwritten state changes.
|
float |
getMaxKvCacheEvictFraction()
The maximum fraction of key-value states evicted from the cache if the
cache is full.
|
int |
getMaxKvInsertBatchSize()
The maximum number of key-value pairs inserted in the database as one
batch operation.
|
int |
getMaxNumberOfSqlRetries()
The number of times each SQL command will be retried on failure.
|
int |
getNumberOfShards()
Number of database shards defined.
|
int |
getNumElementsToEvict()
The number of elements that will be evicted when the cache is full.
|
String |
getShardUrl(int shardIndex)
The url of a specific shard.
|
List<String> |
getShardUrls()
Database shard urls as provided in the constructor.
|
int |
getSleepBetweenSqlRetries()
The number of milliseconds slept between two SQL retries.
|
String |
getUrl()
The url of the first shard.
|
String |
getUserName()
The username used to connect to the database at the given urls.
|
String |
getUserPassword()
The password used to connect to the database at the given url and
username.
|
void |
setDbAdapter(DbAdapter adapter)
Set the
DbAdapter that will be used to operate on the database
during checkpointing. |
void |
setJDBCDriver(String jDBCDriverClassName)
Set the class name that should be used to load the JDBC driver using
Class.forName(JDBCDriverClass).
|
void |
setKvCacheSize(int size)
Set the maximum number of key-value pairs stored in one task instance's
cache before evicting to the underlying database.
|
void |
setKvStateCompactionFrequency(int compactEvery)
Sets how often will automatic compaction be performed on the database to
remove old overwritten state changes.
|
void |
setMaxKvCacheEvictFraction(float fraction)
Sets the maximum fraction of key-value states evicted from the cache if
the cache is full.
|
void |
setMaxKvInsertBatchSize(int size)
Set the maximum number of key-value pairs inserted in the database as one
batch operation.
|
void |
setMaxNumberOfSqlRetries(int maxNumberOfSqlRetries)
Sets the number of times each SQL command will be retried on failure.
|
void |
setPartitioner(ShardedConnection.Partitioner partitioner)
Sets the partitioner used to assign keys to different database shards
|
void |
setSleepBetweenSqlRetries(int sleepBetweenSqlRetries)
Sets the number of milliseconds slept between two SQL retries.
|
public DbBackendConfig(String dbUserName, String dbUserPassword, List<String> dbShardUrls)
MySqlAdapter
.dbUserName
- The username used to connect to the database at the given url.dbUserPassword
- The password used to connect to the database at the given url
and username.dbShardUrls
- The list of JDBC urls of the databases that will be used as
shards for the state backend. Sharding of the state will
happen based on the subtask index of the given task.public DbBackendConfig(String dbUserName, String dbUserPassword, String dbUrl)
MySqlAdapter
.dbUserName
- The username used to connect to the database at the given url.dbUserPassword
- The password used to connect to the database at the given url
and username.dbUrl
- The JDBC url of the database for example
"jdbc:mysql://localhost:3306/flinkdb".public String getUserName()
public String getUserPassword()
public int getNumberOfShards()
public String getUrl()
public String getShardUrl(int shardIndex)
public DbAdapter getDbAdapter()
DbAdapter
that will be used to operate on the database
during checkpointing.public void setDbAdapter(DbAdapter adapter)
DbAdapter
that will be used to operate on the database
during checkpointing.public String getJDBCDriver()
public void setJDBCDriver(String jDBCDriverClassName)
public int getKvCacheSize()
public void setKvCacheSize(int size)
public int getMaxKvInsertBatchSize()
public void setMaxKvInsertBatchSize(int size)
public void setMaxKvCacheEvictFraction(float fraction)
public float getMaxKvCacheEvictFraction()
public int getNumElementsToEvict()
public void setKvStateCompactionFrequency(int compactEvery)
By default automatic compaction is turned off.
public int getKvStateCompactionFrequency()
By default automatic compaction is turned off.
public int getMaxNumberOfSqlRetries()
public void setMaxNumberOfSqlRetries(int maxNumberOfSqlRetries)
public int getSleepBetweenSqlRetries()
public void setSleepBetweenSqlRetries(int sleepBetweenSqlRetries)
public void setPartitioner(ShardedConnection.Partitioner partitioner)
public ShardedConnection createShardedConnection() throws SQLException
ShardedConnection
using the set parameters.SQLException
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.