open-falcon(v0.2)部署手册(源码编译)

今天安装falcon-plus,下面为用基础环境配置。

centos 6.8  alisql5.6.32   redis-3.2.8 cmake-3.9.1 bison-3.0 openssl-1.0.2h redis-3.2.8

yum环境安装

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel zip unzip ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssh openssl-devel libxslt-devel libevent-devel ntp  libtool-ltdl bison libtool vim-enhanced python wget lsof iptraf strace lrzsz kernel-devel kernel-headers pam-devel Tcl/Tk  cmake  ncurses-devel bison setuptool popt-devel net-snmp screen perl-devel pcre-devel net-snmp screen tcpdump rsync sysstat man  sudo idconfig git system-config-network-tui bind-utils update arpscan tmux elinks numactl iftop  bwm-ng redhat-lsb-core
yum -y install  readline* gcc* xmlto kernel-devel yum* screen vim* psmisc wget lrzsz pcre-devel libtidy libtidy-devel iptraf sysstat libevent libevent-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker tar rrdtool ntp* dos2unix setup* net-snmp-utils net-snmp-devel ruby ruby-devel php-snmp cmake net-snmp-perl net-snmp net-snmp-libs wget elinks make autoconf213 m4 gcc gcc-c++ automake autoconf fontconfig fontconfig-devel libjpeg libjpeg* libjpeg-devel libpng libpng-devel freetype freetype* freetype-devel libxml2 libxml2-devel libdhash libdhash-devel  libxslt* zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2* libc-client libc-client-devel libicu-devel ncurses ncurses-devel xmlrpc-c xmlrpc-c-devel curl curl-devel e2fsprogs e2fsprogs-devel  krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers net-tools deltarpm gd gd-devel pam* gettext gettext-devel  keyutils  compat* mpfr cpp libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libXpm*  php-gd ncurses* libtool*  patch unzip bison-devel bison libcom_err-devel libsepol-devel gtk* libselinux-devel libtiff libtiff*  php-common policycoreutils telnet t1lib t1lib* nasm nasm*

cmake安装

yum remove cmake
wget https://cmake.org/files/v3.9/cmake-3.9.1.tar.gz . tar zxvf
cmake-3.9.1.tar.gz
cd cmake-3.9.1 ./configure make && make install
cmake -version
----------------------
显示如下成功 cmake version 3.9.1

bison安装

yum remove bison*
wget http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz .
tar zxvf bison-3.0.tar.gz
cd bison-3.0
./configure
make && make install bison --version
-------------------- 显示如下成功 bison (GNU Bison) 3.0

openssl安装

wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz .
yum install -y zlib
tar zxf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
./config shared zlib
make
make install mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo “/usr/local/ssl/lib” >> /etc/ld.so.conf
ldconfig -v openssl version -a
-------------------
显示如下成功

OpenSSL 1.0.2h  3 May 2016

创建用户和所属组

groupadd mysql
useradd -M -s/sbin/nologin -g mysql -r mysql

改变并且使用devtoolset-4 里面的GCC 套装

yum install scl-utils centos-release-scl-rh centos-release-scl
yum install devtoolset-4
yum install devtoolset-4-gcc*
scl enable devtoolset-4 bash
gcc -v
-------------
显示如下成功

gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)

下载阿里开源数据库

wget https://github.com/alibaba/AliSQL/archive/master.zip .
unzip master.zip
cd AliSQL-master
cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DWITH_EMBEDDED_SERVER=0 -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1  -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_CSV_STORAGE_ENGINE=1  -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 
make && make install

安装环境变量

export PATH=/usr/local/mysql/bin:$PATH
开启TokuDB,不执行会提示:[ERROR] TokuDB: Huge pages are enabled, disable them before continuing
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

配置并启动

cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp ./support-files/my-default.cnf /etc/my.cnf
cp ./support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chown -R mysql:mysql /usr/local/mysql vim /etc/profile
export PATH=/usr/local/mysql/bin:$PATH

source /etc/profile
修改启动文件里面的base和data
vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data 启动mysql service mysqld start

开机启动

chkconfig --level 35 mysqld on

设置mysql密码

mysqladmin -u root password

安装redis

tar zxvf redis-3.2.8.tar.gz
cd redis-3.2.8
make
make PREFIX=/usr/local/redis install
mkdir /usr/local/redis/etc
mkdir /usr/local/redis/var
cp redis.conf /usr/local/redis/etc/

修改配置文件

daemonize yes
bind 192.168.20.88
port 6379
timeout 300
loglevel notice
logfile "/usr/local/redis/var/redis.log"
databases 16
dbfilename dump.rdb
dir "/usr/local/redis/var"
#requirepass 123456
maxclients 10000
maxmemory 1024MB appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec

启动redis

/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

编译二进制文件

因为我的golang是原安装默认位置在/usr/lib/golang/,所以要在这个目录下建立github.com/open-falcon/
cd /usr/lib/golang/src/github.com/open-falcon/
git clone https://github.com/open-falcon/falcon-plus.git
cd falcon-plus
make all
make pack 建立工作目录
export HOME=/home/work
export WORKSPACE=$HOME/open-falcon
mkdir -p $WORKSPACE
cd /home/work/open-falcon
tar -zxvf /usr/lib/golang/src/github.com/open-falcon/open-falcon-v0.2.0.tar.gz -C /home/work/open-falcon

查找要修改的数据库文件,修改password为你的数据库密码

grep -r root ./*/config/cfg.json

open-falcon(v0.2)部署手册(源码编译)

检查redis配置

open-falcon(v0.2)部署手册(源码编译)

导入数据库文件

cd $GOPATH/src/github.com/open-falcon/falcon-plus/scripts/mysql/db_schema/
mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql

启动falcon

./open-falcon start

open-falcon(v0.2)部署手册(源码编译)

检查

./open-falcon check

open-falcon(v0.2)部署手册(源码编译)

安装登录页

备注: dashboard 和open-falcon 同级目录

cd $WORKSPACE
git clone https://github.com/open-falcon/dashboard.git
安装依赖包
yum install -y python-virtualenv
yum install -y python-devel
yum install -y openldap-devel
yum groupinstall "Development tools" 安装插件
cd $WORKSPACE/dashboard/
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt

修改配置

dashboard的配置文件为: 'rrd/config.py',请根据实际情况修改

## API_ADDR 表示后端api组件的地址
API_ADDR = "http://127.0.0.1:8080/api/v1" ## 根据实际情况,修改PORTAL_DB_*, 默认用户名为root,默认密码为""
## 根据实际情况,修改ALARM_DB_*, 默认用户名为root,默认密码为""

open-falcon(v0.2)部署手册(源码编译)

在生产环境启动

先用./env/bin/python wsgi.py 测试启动是否正确

如果报so文件找不到,是因为你自己安装的msyql没有关联系统目录下

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18 (32位)
  ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 (64位)

生产方式启动
bash control start

访问

open http://IP:8081 in your browser.

open-falcon(v0.2)部署手册(源码编译)

注册

open-falcon(v0.2)部署手册(源码编译)

登陆

open-falcon(v0.2)部署手册(源码编译)

页面

open-falcon(v0.2)部署手册(源码编译)

-------------------------------------------

在其他机器安装agent

复制一份agent出来,修改里面的2处配置文件

vim agent/config/cfg.json

把图里0.0.0.0替换成open-falcon也就是server端的地址

open-falcon(v0.2)部署手册(源码编译)

然后打包此agent

tar zcvf agent.tar.gz agent

把这个修改完的agent可以放到任意你需要采集的机器上去,启动agengt(open-falcon是server的你可以复制一个过去)

./open-falcon start agent
上一篇:html5中viewport使用


下一篇:extJS 中 ext.data 介绍