MatrixGate Get started quickly

This document introduces the basic usage of MatrixGate, including the following:


1 Generate mxgate configuration file

First, you need to specify the target database and target table to generate the mxgate configuration file. This paper takes the three-node cluster as an example. The master node (Master) is mdw, and the data nodes are sdw1 and sdw2 respectively.

[mxadmin@mdw ~]$mxgate config --db-database demo --target public.testtable --target public.testtable2 --allow-dynamic > mxgate.conf

The above parameters will generate a configuration file mxgate.conf. You can personalize the loading of testtable and testtable2, and you can also use the global default settings to load data into other tables.


2 Modify the mxgate configuration file (optional)

Modify the mxgate configuration file as needed, such as configuration data separators, etc., and select the default configuration to ignore this step. You can see the settings corresponding to testtable and testtable2 in this configuration file as follows:

    [[job.target]]
      # delimiter = "|"
      # exclude-columns = []
      # format = "text"
      name = "job_text_to_public.testtable"
      # null-as = ""
      table = "public.testtable"
      # time-format = "unix-second"
      # use-auto-increment = true

    [[job.target]]
      # delimiter = "|"
      # exclude-columns = []
      # format = "text"
      name = "job_text_to_public.testtable2"
      # null-as = ""
      table = "public.testtable2"
      # time-format = "unix-second"
      # use-auto-increment = true

If the delimiter of testtable is @ and the delimiter of testtable2 is %, the above configuration can be modified to:

    [[job.target]]
      delimiter = "@"
      # exclude-columns = []
      # format = "text"
      name = "job_text_to_public.testtable"
      # null-as = ""
      table = "public.testtable"
      # time-format = "unix-second"
      # use-auto-increment = true

    [[job.target]]
      delimiter = "%"
      # exclude-columns = []
      # format = "text"
      name = "job_text_to_public.testtable2"
      # null-as = ""
      table = "public.testtable2"
      # time-format = "unix-second"
      # use-auto-increment = true

mxgate listens to port 8086 to receive data by default. You can see in mxgate.conf that the http-port sub-item under source.http is set to 8086. If necessary, you can change it to another port:

[source]

  ## Source plugin is the data entrance to MatrixGate
  ## Types restricted to: http
  source = "http"

  [source.http]

    ## Port of http push
    # http-port = 8086

    ## Maximum request body size (after gzip)
    ## The server rejects requests with bodies exceeding this limit.
    # max-body-bytes = 4194304

    ## The maximum number of concurrent HTTP connections to the server
    ## The server response with 503 after exceed this limit.
    # max-concurrency = 40000

3 Start mxgate

Start mxgate, load the configuration file, connect to the demo database, and prepare to receive data loading requests.

[mxadmin@mdw ~]$ mxgate start --config mxgate.conf


4 Check the backend service status

[mxadmin@mdw ~]$ mxgate status


5 Terminate the background service

[mxadmin@mdw ~]$ mxgate stop

When encountering timeout or other problems, you need to force stop, you can do this:

[mxadmin@mdw ~]$ mxgate stop --force

Notes!
For complete command line parameter information of MatrixGate, please refer to MatrixGate Command Line Parameters; for the main functions, please refer to MatrixGate Main Functions.