Setup StarRocks FE development environment on IDEA
This tutorial is based on macOS and has been tested on Apple Chip(M1, M2). Even if you are not using macOS, you can also refer to this tutorial.
There is no 0.13 version of Thrift in the official brew repository; one of our committers created a version in their repo to install.
brew install firstname.lastname@example.org
After installing Thrift successfully, you can check by executing following command:
$ thrift -version
Thrift version 0.13.0
Just use the latest version v3, because the latest version of Protobuf is compatible with the v2 version of the Protobuf used in StarRocks.
brew install protobuf
brew install maven
Openjdk 1.8 or 11
brew install openjdk@11
MacOS is already installed by default.
Everyone's Thrift and Protobuf installation directories may be different, you can use the brew list command to inspect:
brew list email@example.com
brew list protobuf
Configure the StarRocks
Download the StarRocks
git clone https://github.com/StarRocks/starrocks.git
Setup thirdparty directory
installed/bin directory in
cd starrocks && mkdir -p thirdparty/installed/bin
Then create soft link for Thrift and Protobuf respectively.
ln -s /opt/homebrew/bin/thrift thirdparty/installed/bin/thrift
ln -s /opt/homebrew/bin/protoc thirdparty/installed/bin/protoc
Setting environment variables
export JAVA_HOME="/opt/homebrew/Cellar/openjdk@11/11.0.15" # Caution: The jdk version may be different in you desktop
export STARROCKS_THIRDPARTY=$(pwd)/thirdparty # Caution: Make sure you are in the starrocks directory
Generate source code
Many source files in FE need to be generated manually, otherwise IDEA will report an error due to missing files. Execute the following command to automatically generate:
fe directory and use Maven to compile:
mvn install -DskipTests
Open StarRocks in IDEA
StarRocksdirectory in IDEA.
Add Coding style setting To standardize the coding style, you should import the
fe/starrocks_intellij_style.xmlcode style file in IDEA.
Run StarRocks FE in MacOS
Use IDEA to open the
If you execute the Main function directly in
StarRocksFE.java, some errors will be reported. You only need to do some simple settings to run it smoothly.
StarRocksFE.java is in the
- Copy the conf, bin and webroot directories from the StarRocks directory to
cp -r conf fe/conf
cp -r bin fe/bin
cp -r webroot fe/webroot
- Enter the
fedirectory and create the log and meta folders under the
- Set the environment variable, as shown in the following figure:
Modify the priority_networks in
127.0.0.1/24to prevent FE from using the current computer's LAN IP and cause the port fail to bind.
Then you have run StarRocks FE successfully.
DEBUG StarRocks FE in MacOS
If you started the FE with the debug option, you can then attach the IDEA debugger to the FE process.