-
Notifications
You must be signed in to change notification settings - Fork 710
op-guide: add build manual. #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0b02fc5
op-guide: add build manual.
siddontang 350b987
op-guild: add install requirement.
siddontang 56cdc1a
*: update build.
siddontang 84f203b
op-guide: Address comment
siddontang d3092c8
*: Address comment.
siddontang ceb17cd
scripts: fix typo.
siddontang 4f25c42
op-guide: Address comment.
siddontang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Build | ||
|
|
||
| ## Supported platforms | ||
|
|
||
| The following table lists TiDB support for common architectures and operating systems. | ||
|
|
||
| |Architecture|Operating System|Status| | ||
| |------------|----------------|------| | ||
| |AMD64|Linux Ubuntu (14.04+)|Stable| | ||
| |AMD64|Linux CentOS (7+)|Stable| | ||
| |AMD64|Mac OSX|Experimental| | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| + Go [1.5+](https://golang.org/doc/install) | ||
| + Rust [nightly version](https://www.rust-lang.org/downloads.html) | ||
| + GCC 4.8+ with static library | ||
|
|
||
| The [check requirement script](../scripts/check_requirement.sh) can help you check prerequisites and | ||
| install the missing ones automatically. | ||
|
|
||
| ## Building and installing TiDB components | ||
|
|
||
| You can use the [build script](../scripts/build.sh) to build and install TiDB components in the bin` directory. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Use current path for building and installing TiDB. | ||
| TIDB_PATH=`PWD` | ||
| echo "building TiDB components in $TIDB_PATH" | ||
|
|
||
| # All the binaries are installed in the `bin` directory. | ||
| mkdir -p $TIDB_PATH/bin | ||
|
|
||
| # Assume we install go in /usr/local/go | ||
| export PATH=$PATH:/usr/local/go/bin | ||
|
|
||
| echo "checking go is installed" | ||
| # go is required | ||
| go version | ||
| # go version go1.6 darwin/amd64 | ||
|
|
||
| echo "checking rust is installed" | ||
| # rust nightly is required | ||
| rustc -V | ||
| # rustc 1.12.0-nightly (7ad125c4e 2016-07-11) | ||
|
|
||
| # GOPATH should be set correctly. | ||
| export GOPATH=$TIDB_PATH/deps/go | ||
|
|
||
| build TiDB | ||
| echo "building TiDB..." | ||
| rm -rf $GOPATH/src/github.com/pingcap/tidb | ||
| git clone --depth=1 https://github.com/pingcap/tidb.git $GOPATH/src/github.com/pingcap/tidb | ||
| cd $GOPATH/src/github.com/pingcap/tidb | ||
|
|
||
| make server | ||
| cp -f ./tidb-server/tidb-server $TIDB_PATH/bin | ||
| cd $TIDB_PATH | ||
| echo "build TiDB OK" | ||
|
|
||
| # build PD | ||
| echo "building PD..." | ||
| rm -rf $GOPATH/src/github.com/pingcap/pd | ||
| git clone --depth=1 https://github.com/pingcap/pd.git $GOPATH/src/github.com/pingcap/pd | ||
| cd $GOPATH/src/github.com/pingcap/pd | ||
|
|
||
| make build | ||
| cp -f ./bin/pd-server $TIDB_PATH/bin | ||
| cp -rf ./templates $TIDB_PATH/bin/templates | ||
| cd $TIDB_PATH | ||
| echo "build PD OK" | ||
|
|
||
| # build TiKV | ||
| echo "building TiKV..." | ||
| rm -rf $TIDB_PATH/deps/tikv | ||
| git clone --depth=1 https://github.com/pingcap/tikv.git $TIDB_PATH/deps/tikv | ||
| cd $TIDB_PATH/deps/tikv | ||
|
|
||
| ROCKSDB_SYS_STATIC=1 make release | ||
|
|
||
| cp -f ./target/release/tikv-server $TIDB_PATH/bin | ||
| cd $TIDB_PATH | ||
| echo "build TiKV OK" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| echo "Checking requirements..." | ||
|
|
||
| SUDO= | ||
| if which sudo &>/dev/null; then | ||
| SUDO=sudo | ||
| fi | ||
|
|
||
| function get_linux_platform { | ||
| if [ -f /etc/redhat-release ]; then | ||
| # For CentOS or redhat, we treat all as CentOS. | ||
| echo "CentOS" | ||
| elif [ -f /etc/lsb-release ]; then | ||
| DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'` | ||
| echo "$DIST" | ||
| else | ||
| echo "Unknown" | ||
| fi | ||
| } | ||
|
|
||
| function install_go { | ||
| echo "Intall go ..." | ||
| case "$OSTYPE" in | ||
| linux*) | ||
| curl -L https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz -o golang.tar.gz | ||
| ${SUDO} tar -C /usr/local -xzf golang.tar.gz | ||
| rm golang.tar.gz | ||
| ;; | ||
|
|
||
| darwin*) | ||
| curl -L https://storage.googleapis.com/golang/go1.6.3.darwin-amd64.tar.gz -o golang.tar.gz | ||
| ${SUDO} tar -C /usr/local -xzf golang.tar.gz | ||
| rm golang.tar.gz | ||
| ;; | ||
|
|
||
| *) | ||
| echo "unsupported $OSTYPE" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| function install_gpp { | ||
| echo "Install g++ ..." | ||
| case "$OSTYPE" in | ||
| linux*) | ||
| dist=$(get_linux_platform) | ||
| case $dist in | ||
| Ubuntu) | ||
| ${SUDO} apt-get install -y g++ | ||
| ;; | ||
| CentOS) | ||
| ${SUDO} yum install -y gcc-c++ libstdc++-static | ||
| ;; | ||
| *) | ||
| echo "unsupported platform $dist, you may install g++ manually" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| ;; | ||
|
|
||
| darwin*) | ||
| # refer to https://github.com/facebook/rocksdb/blob/master/INSTALL.md | ||
| xcode-select --install | ||
| brew update | ||
| brew tap homebrew/versions | ||
| brew install gcc48 --use-llvm | ||
| ;; | ||
|
|
||
| *) | ||
| echo "unsupported $OSTYPE" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| # Check rust | ||
| if which cargo &>/dev/null; then | ||
| if ! cargo --version | grep nightly &>/dev/null; then | ||
| echo "Please upgrade Rust to nightly." | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Install Rust ..." | ||
| ${SUDO} curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly | ||
| fi | ||
|
|
||
| # Check go | ||
| if which go &>/dev/null; then | ||
| # requires go >= 1.5 | ||
| GO_VER_1=`go version | awk 'match($0, /([0-9])+(\.[0-9])+/) { ver = substr($0, RSTART, RLENGTH); split(ver, n, "."); print n[1];}'` | ||
| GO_VER_2=`go version | awk 'match($0, /([0-9])+(\.[0-9])+/) { ver = substr($0, RSTART, RLENGTH); split(ver, n, "."); print n[2];}'` | ||
| if [[ (($GO_VER_1 -eq 1 && $GO_VER_2 -lt 5)) || (($GO_VER_1 -lt 1)) ]]; then | ||
| echo "Please upgrade Go to 1.5 or later." | ||
| exit 1 | ||
| fi | ||
| else | ||
| install_go | ||
| fi | ||
|
|
||
| # Check g++ | ||
| if which g++ &>/dev/null; then | ||
| # Check g++ version, RocksDB requires >= 4.7 | ||
| G_VER_1=`g++ -dumpversion | awk '{split($0, n, "."); print n[1];}'` | ||
| G_VER_2=`g++ -dumpversion | awk '{split($0, n, "."); print n[2];}'` | ||
| if [[ (($G_VER_1 -eq 4 && $G_VER_2 -lt 7)) || (($G_VER_1 -lt 4)) ]]; then | ||
| echo "Please upgrade g++ to 4.7 or later." | ||
| exit 1 | ||
| fi | ||
| else | ||
| install_gpp | ||
| fi | ||
|
|
||
| echo OK |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the memory requrement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can users use a 1GB machine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no need.