maxwell配置文件

config.properties
log_level=info

producer=kafka
kafka.bootstrap.servers=192.168.4.106:9092

output_ddl=true
kafka_topic=maxwell
ddl_kafka_topic=maxwell_ddl


# mysql login info
host=192.168.4.210
user=maxwell
password=maxwell
filter.js
/*
 * your javascript filter should define at least
 * one of (process_row, process_heartbeat, process_ddl).
 *
 * `process_row` is called post-filter, for all unfiltered data rows
 *
 * process_row must take one parameter, an instance of `WrappedRowMap`.  WrappedRowMap's javascript api looks like:
 *
 * .suppress() -> call this to remove row from output
 * .kafka_topic = "topic" -> override the default kafka topic for this row
 * .partition_string = "string" -> override kafka/kinesis partition-by string
 * .data -> hash containing row data.  May be modified.
 * .old_data -> hash containing old data
 * .extra_attributes -> if you set values in this hash, they will be output at the top level of the final JSON
 * .type -> "insert" | "update" | "delete"
 * .table -> table name
 * .database -> database name
 * .position -> binlog position of event as string
 * .xid -> transaction XID
 * .server_id -> server id
 * .thread_id -> client thread_id
 * .timestamp -> row timestamp
 *
 */

function process_row(row) {
	if ( row.type == "insert" || row.type == 'update' || row.type == 'delete') {
		  row.suppress();
	}
}


/*
function process_row(row) {
	if ( row.database == "shard_1" ) {
		if ( row.table == "fo" ) {
			row.suppress();
		} else if ( row.table == "sharded" ) {
			if ( row.type == "insert" ) {
				row.data.put("password", "XXXXXXXX");
			}
		} else if ( row.table == "other" ) {
			row.kafka_topic = "other_kafka_topic";
		} else if ( row.table == "iterate_me" ) {
			for each (var key in row.data.keySet()) {
				logger.info(row.data[key]);
			}
		}
	}
}
*/

/*
 * `process_ddl` must take one parameter, an instance of `WrappedDDLMap`.  WrappedDDLMap responds to:
 * .suppress() -> call this to remove row from output
 * .kafka_topic = "topic" -> override the default kafka topic for this row
 * .extra_attributes -> if you set values in this hash, they will be output at the top level of the final JSON
 * .type -> DDL-TYPE
 * .table -> table name
 * .database -> database name
 * .position -> binlog position of event as string
 * .timestamp -> row timestamp in utc seconds
 * .change -> hash-map representing the DDL change.  different for each type of DDL.
 */

/*
function process_ddl(ddl) {
	logger.info(ddl.change);
	logger.info(ddl.table);
	logger.info(ddl.database);

	ddl.extra_attributes['hello'] = 'world';
	if ( ddl.table == "foo" )
		ddl.suppress();
}*/


/*
 * `process_heartbeat` must take one parameter, an instance of `WrappedHeartbeatMap`.  WrappedHeartbeatMap responds to:
 * .position -> binlog position of event as string
 * .timestamp -> row timestamp in utc seconds
 * .heartbeat -> timestamp of when heartbeat was sent, in utc milliseconds
 */
 

/*
function process_heartbeat(heartbeat) {
	logger.info(heartbeat.position);
	logger.info(heartbeat.timestamp);
	logger.info(heartbeat.heartbeat);
}
*/
启动命令
/home/maxwell/opt/maxwell-1.38.0/bin/maxwell --config /home/maxwell/opt/maxwell-1.38.0/config.properties --javascript /home/maxwell/opt/maxwell-1.38.0/filter.js --daemon
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值