Centos 部署 open-falcon 0.3.x 单机部署(一)环境安装
参考链接:
https://book.open-falcon.org/zh_0_2/quick_install/
https://www.cnblogs.com/straycats/p/10787916.html
1 环境配置
1.1 安装wget、vim
yum install -y wget vim
1.2 安装git
yum install -y git
安装结束后,确认是否满足官方要求的Git >= 1.7.5
git version
1.3 安装golang
# 通过fedora的epel仓库来安装golang
yum install -y epel-release
yum install -y golang
安装结束后,确认是否满足官方要求的Go >= 1.6
go version
或者参考https://www.cnblogs.com/reboot777/p/10985731.html
(1)下载golang安装包
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
(2)解压至/usr/local文件夹
tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz
(3)配置环境变量
vim /etc/profile
export GOROOT=/usr/local/go export GOBIN=$GOROOT/bin export PATH=$PATH:$GOBIN
source /etc/profile使修改生效.
go env 测试
1.4 安装mariadb及启动
yum install mariadb-server mariadb systemctl start mariadb #启动MariaDB systemctl stop mariadb #停止MariaDB systemctl restart mariadb #重启MariaDB systemctl enable mariadb #设置开机启动 systemctl status mariadb.service # 查看状态
1.5 安装redis
# 通过fedora的epel仓库来安装redis
yum install -y epel-release
yum install -y redis
#
systemctl start redis
systemctl enable redis
1.6 设置临时变量,拉取后端(open-falcon)的源码
export GOROOT=/usr/lib/golang
export GOPATH=/data/worktable
#
mkdir -p $GOPATH/src/github.com/open-falcon
#
cd $GOPATH/src/github.com/open-falcon
#
git clone https://github.com/open-falcon/falcon-plus.git
1.7 初始化数据库
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
PS.在运行“mysql -h..................”时会提示“Enter password”,如果mysql的root没有设置密码,回车即可。
若要设置更改密码
更改mysql用户名密码
1
vi /etc/my.cnf
2 在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程
3 重启MariaDB
systemctl restart mariadb
4 mysql -u root -p
在sql里输入命令
use mysql; update user set authentication_string=PASSWORD("") where User='root'; update user set plugin="YOUR_KEY_WORDS"; flush privileges; quit;
4 将my.cnf修改回来
5 再次重启mysql,完毕
1.8 编译后端的源码并打包
cd $GOPATH/src/github.com/open-falcon/falcon-plus
make all
make pack
如果报错运行.sh文件提示‘\r’ command not found
解决方法
1 vim 文件
2 输入 : set ff=unix 然后一直回车
3 保存
打包完成后,工作目录/src/github.com/open-falcon/falcon-plus/目录下多了刚才打的压缩包“open-falcon-v0.3.tar.gz”