Source SingleStore#
The extractedreplicant-cli will be referred to as the$REPLICANT_HOME directory in the proceeding steps.
I. Set up Connection Configuration#
From
$REPLICANT_HOME, navigate to the sample connection configuration file:vi conf/conn/singlestore.yamlFor connecting to the SingleStore server, you can choose between two methods for an authenticated connection:
Connect with username and password#
For connecting to SingleStore using via basic username and password authentication, you have the following two options:
You can specify your credentials in plain form in the connection configuration file like the following sample:
type:SINGLESTOREhost:HOSTNAMEport:PORT_NUMBERusername:'USERNAME'password:'PASSWORD'max-connections:30max-retries:10retry-wait-duration-ms:1000Replace the following:
HOSTNAME: hostname of the SingleStore serverPORT_NUMBER: port number of the SingleStore serverUSERNAME: the SingleStore usernamePASSWORD: the password associated withUSERNAME
You can store your connection credentials in a secrets management service and tell Replicant to retrieve the credentials. For more information, seeSecrets management.Connect using SSL#
To connect to SingleStore using SSL, follow these steps:
Configure the server-side requirements by following the instructions inServer Configuration for Secure Client and Intra-Cluster Connections.
Specify the SSL parameters to Replicant in the
sslsection of the connection configuration file in the following format:ssl:enable:trueroot-cert:"PATH_TO_CA_CERTIFICATE_FILE"hostname-verification: {true|false}trust-store:path:PATH_TO_CA_TRUSTSTOREpassword:TRUSTSTORE_PASSWORDkey-store:path:PATH_TO_KEYSTOREpassword:KEYSTORE_PASSWORDssl-key-password:KEYSTORE_CERT_PASSWORDIn the preceding configuration:
root-certholds the full path to your SSL CA certificate file—for example,"/home/alex/workspace/ca-cert.pem". Keep in mind that thetrust-storeconfiguration overridesroot-cert.hostname-verificationenables hostname verification against the server identity according to the specification in the server’s certificate. Defaults totrue.trust-storeholds the SSL CA certificate that the client uses to authenticate the server. This configuration overridesroot-cert.Replace
PATH_TO_CA_TRUSTSTOREandTRUSTSTORE_PASSWORDwith the path to the TrustStore and the TrustStore password respectively.The server uses
key-storeto authenticate the client. ReplacePATH_TO_KEYSTOREandKEYSTORE_PASSWORDwith the path to the KeyStore and the KeyStore password respectively.As an optional parameter,
ssl-key-passwordholds the password of the certificate inside the KeyStore.
II. Set up Extractor Configuration#
From
$REPLICANT_HOME, navigate to the Extractor configuration file:vi conf/src/singlestore.yamla. For snapshot mode, make the necessary changes as follows in the
snapshotsection of the configuration file:snapshot:#threads: 32#fetch-size-rows: 10_000#min-job-size-rows: 1_000_000max-jobs-per-chunk:32#verify-row-count: false_traceDBTasks:trueper-table-config: -catalog:tpchtables:# testTable# split-key: split-key-columnpart:split-key:partkeypartsupp:split-key:partkeysupplier:orders:split-key:orderkeylineitem:row-identifier-key: [l_orderkey, l_linenumber]split-key:l_orderkey# split-hints:# row-count-estimate: 15000# split-key-min-value: 1# split-key-max-value: 60_000b. For delta snapshot mode, you can add
delta-snapshot-keycolumn to SingleStore tables if not present already with the followingALTER(andUPDATE) statement per table.ALTERTABLE tpch.LINEITEM_CSADDCOLUMN replicate_io_delta_snapshot_keyTIMESTAMPNOTNULLDEFAULTcurrent_timestampONUPDATEcurrent_timestamp;UPDATE tpch.LINEITEM_CSset replicate_io_delta_snapshot_key=current_timestamp;Then make the necessary changes as follows in the
delta-snapshotsection of the configuration file:delta-snapshot:#threads: 32#fetch-size-rows: 10_000#min-job-size-rows: 1_000_000max-jobs-per-chunk:32_max-delete-jobs-per-chunk:32delta-snapshot-key:last_update_timedelta-snapshot-interval:10delta-snapshot-delete-interval:10_traceDBTasks:truereplicate-deletes:falseper-table-config: -schema:tpchtables:# testTable# split-key: split-key-column # Any numeric/timestamp column with sufficiently large number of distincts# split-hints:# row-count-estimate: 100000 # Estimated row count, if supplied replicant will leverage# split-key-min-value: 1 #Lower bound of split key value# split-key-max-value: 60_000 #Upper bound of split key value, if supplied replicant will leverage and avoid querying source database for the same# delta-snapshot-key: delta-snapshot-key-column # A monotonic increasing numeric/timestamp column which gets new value on each INSERT/UPDATE# row-identifier-key: [col1, col2] # A set of columns which uniquely identify a row# update-key: [col1, col2] # A set of columns which replicant should use to perform deletes/updates during incremental replicationpart:split-key:partkeypartsupp:split-key:partkeysupplier:orders:split-key:orderkeyparts_view:update-key: [partkey]delta-snapshot-key:last_update_timesplit-key:last_update_timepartsupp_macro:update-key: [partkey]delta-snapshot-key:last_update_timesplit-key:last_update_time
For a detailed explanation of configuration parameters in the extractor file, readExtractor Reference.