Documentation ¶
Index ¶
- Variables
- func EquelMysqlGTIDSet(set1, set2 *mysql.MysqlGTIDSet) bool
- func GetPKValues(table *schema.Table, row []interface{}) ([]interface{}, error)
- func GetStopPosByUUIDSet(uuidSet *mysql.UUIDSet) int64
- func HtmlStrip(input interface{}) (string, error)
- func IsStringSliceDiff(str1 []string, str2 []string) bool
- func ParseMysqlGTIDSet(str string) (*mysql.MysqlGTIDSet, error)
- type ActionMapping
- type Config
- type River
- type Rule
- type SourceConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRuleNotExist = errors.New("rule is not exist")
Functions ¶
func EquelMysqlGTIDSet ¶
func EquelMysqlGTIDSet(set1, set2 *mysql.MysqlGTIDSet) bool
func GetPKValues ¶
Get primary keys in one row for a table, a table may use multi fields as the PK
func GetStopPosByUUIDSet ¶
func IsStringSliceDiff ¶
func ParseMysqlGTIDSet ¶
func ParseMysqlGTIDSet(str string) (*mysql.MysqlGTIDSet, error)
Types ¶
type ActionMapping ¶
type Config ¶
type Config struct { MyAddr string `toml:"my_addr"` MyUser string `toml:"my_user"` MyPassword string `toml:"my_pass"` MyCharset string `toml:"my_charset"` ESAddr string `toml:"es_addr"` StatAddr string `toml:"stat_addr"` ServerID uint32 `toml:"server_id"` Flavor string `toml:"flavor"` DataDir string `toml:"data_dir"` DumpExec string `toml:"mysqldump"` Sources []SourceConfig `toml:"source"` Rules []*Rule `toml:"rule"` HealthCheckInterval int `toml:"health_check_interval"` HealthCheckPosThreshold int `toml:"health_check_pos_threshold"` HealthCheckEnable bool `toml:"health_check_enable"` HealthCheckOuputDir string `toml:"health_check_output_dir"` }
func NewConfigWithFile ¶
type River ¶
type River struct {
// contains filtered or unexported fields
}
In Elasticsearch, river is a pluggable service within Elasticsearch pulling data then indexing it into Elasticsearch. We use this definition here too, although it may not run within Elasticsearch. Maybe later I can implement a acutal river in Elasticsearch, but I must learn java. :-)
type Rule ¶
type Rule struct { Schema string `toml:"schema"` Table string `toml:"table"` Index string `toml:"index"` Type string `toml:"type"` Parent string `toml:"parent"` IDColumns string `toml:"id_columns"` HtmlStripColumns string `toml:"html_strip_columns"` JSONColumns string `toml:"json_columns"` // Default, a MySQL table field name is mapped to Elasticsearch field name. // Sometimes, you want to use different name, e.g, the MySQL file name is title, // but in Elasticsearch, you want to name it my_title. FieldMapping map[string]string `toml:"field"` // 指定es字段可由其他es字段拼接而成,目前仅支持INSERT数据库事件 // 后续可优化成 "{{id_key}}{{number}}" 的模版形式以支持更多场景 ESFieldMapping map[string]string `toml:"es_field"` // MySQL table information TableInfo *schema.Table CustomActionMapping []*ActionMapping `toml:"action"` ActionMapping map[string]*ActionMapping }
If you want to sync MySQL data into elasticsearch, you must set a rule to let use know how to do it. The mapping rule may thi: schema + table <-> index + document type. schema and table is for MySQL, index and document type is for Elasticsearch.
type SourceConfig ¶
Click to show internal directories.
Click to hide internal directories.