交叉编译环境:
wget https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
tar -Jxf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
export PATH=$PATH:"`pwd`/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/"
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
export LD=aarch64-linux-gnu-ld
export AR=aarch64-linux-gnu-ar
export RANLIB=aarch64-linux-gnu-ranlib
单独编译jemalloc、leveldb和snappy:
git clone https://github.com/ideawu/ssdb.git
cd ssdb/deps/jemalloc-4.1.0/
./autogen.sh --host=aarch64-linux-gnu && make
cd ../leveldb-1.20/
make
cd ../snappy-1.1.0/
./configure --host=aarch64-linux-gnu && make
cd ../../
编译ssdb:
cat > build_config.mk <<EOF
CFLAGS = -DNDEBUG -D__STDC_FORMAT_MACROS -Wall -O2 -Wno-sign-compare
CFLAGS += -I "`pwd`/deps/leveldb-1.20/include"
CFLAGS += -I "`pwd`/deps/jemalloc-4.1.0/include"
CFLAGS += -DNEW_MAC
CLIBS = "`pwd`/deps/leveldb-1.20/out-static/libleveldb.a"
CLIBS += "`pwd`/deps/snappy-1.1.0/.libs/libsnappy.a"
CLIBS += "`pwd`/deps/jemalloc-4.1.0/lib/libjemalloc.a"
CLIBS += -pthread -lrt
EOF
sed -i 's/\$(shell sh/#\$(shell sh/' Makefile
sed -i 's/chmod u+x "\${LEVELDB_PATH}/#chmod u+x "\${LEVELDB_PATH}/' Makefile
sed -i 's/cd "\${LEVELDB_PATH}/#cd "\${LEVELDB_PATH}/' Makefile
make
systemd管理:
[Unit]
Description=ssdb service
After=network.target
[Service]
LimitNOFILE=65535
Type=simple
User=ssdb
#PIDFile=/var/run/ssdb.pid
ExecStart=/usr/local/ssdb/ssdb-server /usr/local/ssdb/ssdb.conf -s start
ExecStop=/usr/local/ssdb/ssdb-server /usr/local/ssdb/ssdb.conf -s stop
#Restart=always
#RestartSec=5
#StartLimitBurst=3
#StartLimitInterval=60
#StandardOutput=null
#StandardError=null
[Install]
WantedBy=multi-user.target
使用ssdb用户运行,新建用户,数据目录给予权限:
useradd -M -s /usr/sbin/nologin ssdb
chown -R ssdb:ssdb /ssdb-data/
标签:none