MatrixGate Quick Start

This document describes the basic usage of MatrixGate, including the following topics:


1 Generate mxgate Configuration File

First, specify the target database and tables to generate the mxgate configuration file. This example uses a three-node cluster, with the master node (Master) named mdw, and segment nodes named sdw1 and sdw2.

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

The above command generates a configuration file named mxgate.conf. You can customize data loading settings for testtable and testtable2, or use global default settings to load data into other tables.


2 Modify mxgate Configuration File (Optional)

Modify the mxgate configuration file as needed, for example, to set data delimiters. Skip this step if using default settings. The configuration for testtable and testtable2 appears 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 for testtable is @ and for testtable2 is %, update the configuration as shown below:

    [[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

By default, mxgate listens on port 8086 for incoming data. In mxgate.conf, you can find the http-port setting under source.http set to 8086. Change it to another port if necessary:

[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 with the configuration file, connect to the demo database, and prepare to receive data loading requests.

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


4 View Service Status

[mxadmin@mdw ~]$ mxgate status


5 Stop the Service

[mxadmin@mdw ~]$ mxgate stop

To force stop in case of timeout or other issues, run:

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

Note!
For complete command-line options of MatrixGate, see MatrixGate Command-Line Parameters; for main features, see MatrixGate Main Features.