Building from source code

This document will guide you build standalone MatrixOne using source code.

Step 1: Install Go as necessary dependency

  1. Click Go Download and install to enter its official documentation, and follow the installation steps to complete the Go installation.

    Note: Go version 1.19 is required.

  2. To verify whether Go is installed, please execute the code go version. When Go is installed successfully, the example code line is as follows:

    1. go version go1.19 darwin/arm64

Step 2: Install GCC as necessary dependency

  1. To verify whether the GCC is installed:

    1. gcc -v
    2. bash: gcc: command not found

    As shown in the code, the version of GCC is not displayed, the GCC environment needs to be installed.

  2. Click GCC Download and install to enter its official documentation, and follow the installation steps to complete the GCC installation.

    Note: GCC version 8.5 is required.

  3. To verify whether GCC is installed, please execute the code gcc -v. When GCC is installed successfully, the example code line is as follows:

    1. Apple clang version 14.0.0 (clang-1400.0.29.202)
    2. Target: arm64-apple-darwin22.2.0
    3. Thread model: posix
    4. InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Step 3: Get MatrixOne code

Depending on your needs, choose whether you want to keep your code up to date, or if you want to get the latest stable version of the code.

Get the MatrixOne(Develop Version) code to buildGet the MatrixOne(Stable Version) code to build

The main branch is the default branch, the code on the main branch is always up-to-date but not stable enough.

  1. Get the MatrixOne(Develop Version) code:

    1. git clone https://github.com/matrixorigin/matrixone.git
    2. cd matrixone
  2. Run make build to compile the MatrixOne file:

    1. make build

    Tips: You can also run make debug, make clean, or anything else our Makefile offers, make debug can be used to debug the build process, and make clean can be used to clean up the build process. If you get an error like Get "https://proxy.golang.org/........": dial tcp 142.251.43.17:443: i/o timeout while running make build, see Deployment FAQs.

  3. If you want to get the latest stable version code released by MatrixOne, please switch to the branch of version 0.7.0 first.

    1. git clone https://github.com/matrixorigin/matrixone.git
    2. cd matrixone
    3. git checkout 0.7.0
  4. Run make config and make build to compile the MatrixOne file:

    1. make config
    2. make build

    Tips: You can also run make debug, make clean, or anything else our Makefile offers, make debug can be used to debug the build process, and make clean can be used to clean up the build process. If you get an error like Get "https://proxy.golang.org/........": dial tcp 142.251.43.17:443: i/o timeout while running make build, see Deployment FAQs.

Info

MatrixOne only supports installation on ARM chipset with source code build; if you are using MacOS M1 and above, refer to this document to install and deploy the MatrixOne.

Step 4: Launch MatrixOne server

Launch in the frontend**Launch in the backend**

This launch method will keep the mo-service process running in the frontend, the system log will be printed in real time. If you’d like to stop MatrixOne server, just make a CTRL+C or close your current terminal.

  1. # Start mo-service in the frontend
  2. ./mo-service -launch ./etc/quickstart/launch.toml

When you finish launching MatrixOne in the frontend, many logs are generated in startup mode. Then you can start a new terminal and connect to MatrixOne.

This launch method will put the mo-service process running in the backend, the system log will be redirected to the test.log file. If you’d like to stop MatrixOne server, you need to find out its PID by and kill it by the following commands. Below is a full example of the whole process.

  1. # Start mo-service in the backend
  2. ./mo-service --daemon --launch ./etc/quickstart/launch.toml &> test.log &
  3. # Find mo-service PID
  4. ps aux | grep mo-service
  5. [root ~]# ps aux | grep mo-service
  6. root 15277 2.8 16.6 8870276 5338016 ? Sl Nov25 156:59 ./mo-service -launch ./etc/quickstart/launch.toml
  7. root 836740 0.0 0.0 12136 1040 pts/0 S+ 10:39 0:00 grep --color=auto mo-service
  8. # Kill the mo-service process
  9. kill -9 15277

Tips: As shown in the above example, use the command ps aux | grep mo-service to find out that the process number running on MatrixOne is 15277, and kill -9 15277 means to stop MatrixOne with the process number 15277.

Next you can take the next step - Connect to standalone MatrixOne.

Info

If you need to switch branches and launch it again after building on a specific branch, a panic will appear after running, and you will need to clean up the data file directory. See Installation and Deployment Frequently Asked Questions for solutions.

Step 5: Connect to standalone MatrixOne

Install and configure MySQL Client

  1. Click MySQL Community Downloads to enter into the MySQL client download and installation page. According to your operating system and hardware environment, drop down to select Select Operating System > macOS, then drop down to select Select OS Version, and select the download installation package to install as needed.

    Note: MySQL client version 8.0.30 or later is recommended.

  2. Configure the MySQL client environment variables:

    1. Open a new terminal window and enter the following command:

      1. cd ~
      2. sudo vim .bash_profile
    2. After pressing Enter on the keyboard to execute the above command, you need to enter the root user password, which is the root password you set in the installation window when you installed the MySQL client. If no password has been set, press Enter to skip the password.

    3. After entering/skiping the root password, you will enter .bash_profile, click i on the keyboard to enter the insert state, and you can enter the following command at the bottom of the file:

      1. export PATH=${PATH}:/usr/local/mysql/bin
    4. After the input is completed, click esc on the keyboard to exit the insert state, and enter :wq at the bottom to save and exit.

    5. Enter the command source .bash_profile, press Enter to execute, and run the environment variable.

    6. To test whether MySQL is available:

      • Method 1: Enter mysql -u root -p, press Enter to execute, the root user password is required, if mysql> is displayed, it means that the MySQL client is enabled.

      • Method 2: Run the command mysql --version, if MySQL client is installed successfully, the example code line is as follows: mysql Ver 8.0.31 for macos12 on arm64 (MySQL Community Server - GPL)

    7. If MySQL is available, close the current terminal and browse the next chapter Connect to MatrixOne Server.

Tips: Currently, MatrixOne is only compatible with the Oracle MySQL client. This means that some features might not work with the MariaDB client or Percona client.

Connect to MatrixOne

  • You can use the MySQL command-line client to connect to MatrixOne server. Open a new terminal window and enter the following command:

    1. mysql -h IP -P PORT -uUsername -p

    After you enter the preceding command, the terminal will prompt you to provide the username and password. You can use our built-in account:

    • user: dump
    • password: 111
  • You can also use the following command line on the MySQL client to connect to the MatrixOne service:

    1. mysql -h 127.0.0.1 -P 6001 -udump -p
    2. Enter password:

Currently, MatrixOne only supports the TCP listener.