Command Line Usage
Addax provides a simple command-line interface for executing data synchronization jobs.
Basic Syntax
bin/addax.sh [options] job_config_fileCommand Line Options
-h, --help
Display help information and exit.
bin/addax.sh -h-v, --version
Display version information and exit.
bin/addax.sh -v-m, --mode
Set execution mode. Available options:
standalone: Standalone mode (default)local: Local mode
bin/addax.sh -m standalone job.json-j, --jvm
Set JVM parameters.
bin/addax.sh -j "-Xms1g -Xmx4g" job.json-p, --params
Pass runtime parameters for variable substitution in job configuration.
bin/addax.sh -p "-Dhost=localhost -Dport=3306" job.json--reader-plugin
Display information about a specific reader plugin.
bin/addax.sh --reader-plugin mysqlreader--writer-plugin
Display information about a specific writer plugin.
bin/addax.sh --writer-plugin postgresqlwriterUsage Examples
Basic Job Execution
Execute a simple synchronization job:
bin/addax.sh job/mysql_to_postgres.jsonJob with Custom JVM Settings
Execute job with custom memory settings:
bin/addax.sh -j "-Xms2g -Xmx8g -XX:+UseG1GC" job/large_table_sync.jsonJob with Runtime Parameters
Execute job with variable substitution:
bin/addax.sh -p "-Dsource.host=db1.example.com -Dtarget.host=db2.example.com" job/template.jsonWhere template.json contains variables like:
{
"job": {
"content": [
{
"reader": {
"parameter": {
"jdbcUrl": "jdbc:mysql://${source.host}:3306/mydb"
}
},
"writer": {
"parameter": {
"jdbcUrl": "jdbc:postgresql://${target.host}:5432/mydb"
}
}
}
]
}
}Debug Mode
Run job with debug output:
bin/addax.sh -j "-Daddax.debug=true" job.jsonPerformance Monitoring
Run job with performance monitoring enabled:
bin/addax.sh -j "-Daddax.monitor=true" job.jsonExit Codes
Addax uses the following exit codes:
0: Job completed successfully1: Job failed due to configuration error2: Job failed due to runtime error3: Job killed by user or system
Configuration Override
You can override configuration settings via command line parameters:
Override Speed Settings
bin/addax.sh -p "-Djob.setting.speed.channel=5" job.jsonOverride Error Limits
bin/addax.sh -p "-Djob.setting.errorLimit.record=100" job.jsonPlugin Information
List Available Plugins
# List all reader plugins
bin/addax.sh --reader-plugin
# List all writer plugins
bin/addax.sh --writer-pluginGet Plugin Details
# Get MySQL reader details
bin/addax.sh --reader-plugin mysqlreaderGet PostgreSQL writer details
bin/addax.sh --writer-plugin postgresqlwriterEnvironment Variables
You can set the following environment variables to customize Addax behavior:
ADDAX_HOME
Set the Addax installation directory:
export ADDAX_HOME=/opt/addaxJAVA_HOME
Set the Java installation directory:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdkADDAX_OPTS
Set default JVM options:
export ADDAX_OPTS="-Xms1g -Xmx4g"Logging Configuration
Addax uses logback for logging. You can customize logging by:
Setting Log Level
bin/addax.sh -j "-Dlogback.configurationFile=conf/logback-debug.xml" job.jsonCustom Log File
bin/addax.sh -j "-Daddax.log.file=/var/log/addax/job.log" job.jsonBest Practices
Resource Management
- Use appropriate JVM heap sizes based on your data volume
- Monitor memory usage during large data transfers
- Set reasonable channel numbers based on system capacity
Error Handling
- Always check exit codes in scripts
- Set appropriate error limits for your use case
- Review logs for detailed error information
Security
- Avoid passing passwords via command line (use configuration files)
- Use encrypted password files when possible
- Limit file permissions on configuration files
Performance
- Test with different channel numbers to find optimal concurrency
- Use speed limits to prevent overwhelming source/target systems
- Monitor system resources during execution
For more detailed information about specific plugins and configuration options, please refer to the job configuration guide and individual plugin documentation.