Creating Channel in CLI
This section contains instructions on how to use the Local Data Processing command line to create a channel, add locations, actions and tables to the channel, create and run a refresh even, and activate replication in the channel. It also provides additional examples for configuring an High-Volume Agent (HVA) allowing anonymous access and access with user credentials.
For the purpose of this article, it is assumed that an and a and running.
The article includes the following steps:
Remote access to a hub server
All Local Data Processing commands can be executed locally (on the same machine where the hub server is running) or remotely from the hub server. When running the commands remotely from the hub server, authorization is required. Otherwise, you can get the error F_JW0555: Refresh token invalid or expired.
To access a remote hub server with the hvradmin user, run the following command:
hvrlogin -R http://myhost:12345 -u hvradmin
content_copyIn the below examples, in case of running the command remotely from the hub server, use option -R.
For example, the following command imports a location from the oracle.json file to hub myhub.
hvrdefinitionimport -R http://myhost:12345 myhub oracle.json
content_copyCreate a source location
This step includes creating a source location that connects directly to an Oracle database (without using an HVA).
Create a JSON file (e.g. oracle.json) that defines a source location (e.g. oracle).
{ "changes": [ { "add_loc": { "props": { "Capture_Method": "DIRECT", "Class": "oracle", "Database_Password": "ora_pwd", "Database_User": "ora_user", "Oracle_Home": "/distr/oracle/1800", "Oracle_SID": "HVR1800" }, "loc": "oracle" } } ] }content_copyAdd the oracle location to the hub using the command.
hvrdefinitionimport -l oracle myhub oracle.jsoncontent_copy
Create a target location
This step includes creating a target location that connects directly to a Postgres database (without using an HVA).
Create a JSON file (e.g. postgres.json) that defines a target location (e.g. postgres).
{ "changes": [ { "add_loc": { "props": { "Class": "postgresql", "Database_Host": "localhost", "Database_Name": "pg_db", "Database_Password": "pg_pwd", "Database_Port": 11111, "Database_User": "pg_user" }, "loc": "postgres" } } ] }content_copyAdd the target location to the hub using the command.
hvrdefinitionimport -l postgres myhub postgres.jsoncontent_copy
Create a channel
This step includes:
- creating channel mychn
- adding location groups SOURCE and TARGET to the channel
- adding locations oracle and postgres to the channel
- defining action Capture for the SOURCE location group and action Integrate for the TARGET location group
Create a JSON file (e.g. mychn.json) that defines the channel.
{ "changes": [ { "add_channel": { "description": "Oracle to Postgres channel", "loc_groups": { "SOURCE": { "members": [ "oracle" ] }, "TARGET": { "members": [ "postgres" ] } }, "actions": [ { "loc_scope": "SOURCE", "table_scope": "*", "type": "Capture", "params": {} }, { "loc_scope": "TARGET", "table_scope": "*", "type": "Integrate", "params": {} } ], "channel": "mychn" } }, ] }content_copyAdd channel mychn to the hub using the command.
hvrdefinitionimport myhub mychn.jsoncontent_copy
Add tables to the channel
Add tables to the channel using the command.
hvradapt -l oracle myhub mychn
content_copyCreate and run a refresh event
This step assumes that no refresh has been done in the channel before. Run the command to create a refresh event which, once started, will create the absent tables in the target location.
hvrrefresh -J integ -s -r oracle -l postgres -cbkr -gb -qrw myhub mychn
content_copyActivate the channel
Run the command to start the refresh event from the previous step and activate replication in the channel. Once completed, the capture and integrate jobs will be running in the channel.
hvractivate -J cap -J refr -p2 myhub mychn
content_copyAdditional configuration steps
The following examples demonstrate how to configure an HVA for a remote location. In the first case, the HVA is configured to allow anonymous access from a specific hub system. In the second case, an agent user is created with the AgentAdmin permissions that will be used to access the HVA. For more information, see .
Configure HVA Allowing Anonymous Access
On the location where an HVA is and , start the HVA service by running the command.
hvragentlistener -d port_numbercontent_copyGet the agent client public certificate by running the command. Copy the value of the property from the command output.
hvrreposconfig -R http://myhost:12345content_copyModify the agent property to allow anonymous authentication using the command.
hvragentconfig -h myhub -r http://agenthost:11111 -S Anonymous_Access='{"allow":"true"}' Only_From_Client_Public_Certificates='{"http://myhost:12345":"copied value of the Agent_Client_Public_Certificate"}' Setup_Mode_Timed_Until=content_copyCreate a JSON file (e.g. sqlserver.json) that defines the location.
{ "changes": [ { "add_loc": { "props": { "Agent_Host": "myhost", "Agent_Port": 12345, "Capture_Method": "DIRECT", "Class": "sqlserver", "Database_Name": "mydatabase", "Database_Password": "mypasswd", "Database_User": "myuser", "Log_Truncater": "CAP_JOB", "SqlServer_Server": "LT-SERVER", "Supplemental_Logging": "CDCTAB_ARTICLE" }, "loc": "sqlserver" } } ] }content_copyRun the command to add the sqlserver location to the hub.
hvrdefinitionimport -l sqlserver myhub sqlserver.jsoncontent_copy
Configure HVA with Username/Password Authentication
On the location where an HVA is and , start the HVA service using the command. The first time the HVA service is started on this port, it will be in setup mode.
hvragentlistener -d port_numbercontent_copyRun the command to create an AgentAdmin user. You will be prompted to type a password for the user.
This step is optional, but having at least one AgentAdmin user gives the possibility to re-configure the High-Volume Agent when not in setup mode.
hvragentuserconfig -h myhub -r http://agenthost:11111 -S -c hvradmincontent_copyCreate an agent user for a location. You will be prompted to type a password for the user. The authentication to the High-Volume Agent will be done by using a username and password, network traffic will be encrypted using the agent client public certificate from the hub.
hvragentuserconfig -h myhub -r http://agenthost:11111 -S -c agentusercontent_copyModify the User_Access agent property to allow username/password authentication.
hvragentconfig -h myhub -r http://agenthost:11111 -S User_Access='{"agentuser":{"level":"AgentAdmin"}}' Setup_Mode_Timed_Until=content_copyCreate a JSON file (e.g. snowflake.json) that defines the location (e.g. snowflake).
{ "changes": [ { "add_loc": { "props": { "Agent_Host": "http://myhost", "Agent_Password": "mypasswd", "Agent_Port": 11111, "Agent_User": "agentuser", "Class": "snowflake", "Database_Host": "hvr_partner.west-europe.azure.snowflakecomputing.com", "Database_Name": "myhub", "Database_Password": "mypasswd", "Database_Port": 123, "Database_Schema": "hvrschema", "Database_User": "dbuser", "ODBC_Driver": "SnowflakeDSIIDriver", "Snowflake_Role": "public", "Snowflake_Warehouse": "hvrware" }, "loc": "snowflake" } } ] }content_copyRun the command to add the snowflake location to the hub.
hvrdefinitionimport -l snowflake myhub snowflake.jsoncontent_copy
Comments
0 comments
Please sign in to leave a comment.