首页 > 代码库 > 玩转open-falcon

玩转open-falcon

#1
 wget https://github.com/XiaoMi/open-falcon/releases/download/0.0.5/open-falcon-0.0.5.tar.gz -O open-falcon.tar.gz
 mkdir tmp
 tar -zxvf open-falcon.tar.gz -C ./tmp

更新yum源
  cd /etc/yum.repos.d/
  mv CentOS-Base.repo CentOS-Base.repo.backup
  wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
  yum makecache
  yum -y update
 
 发现repos.fedorapeople.org 404, 我们要找到干掉
 grep -l repos.fedorapeople.org ./*.repo

#2
  yum install redis-server
  yum install mysql-server

如果遇见mysql忘记密码
  #1 在 /etc/my.cnf 添加 skip-grant-tables  注意: 修改后把这个注释掉
  #2 /etc/init.d/mysqld restart
  #3 update mysql.user set password=PASSWORD(‘123456‘) where user=‘root‘;

#3
  yum install git* -y
  git clone https://github.com/open-falcon/scripts.git
  cd scripts
  mysql -h localhost -u root -p < db_schema/graph-db-schema.sql
  mysql -h localhost -u root -p < db_schema/dashboard-db-schema.sql
  mysql -h localhost -u root -p < db_schema/portal-db-schema.sql
  mysql -h localhost -u root -p < db_schema/links-db-schema.sql
  mysql -h localhost -u root -p < db_schema/uic-db-schema.sql
  注意:上述mysql如果设密码,需要输入密码

#4 安装agent (该安装需要在采集数据上报的机器上装)
   将falcon-agent-5.1.0.tar.gz 拷贝去
   passd 123456
   scp falcon-agent-5.1.0.tar.gz 192.168.11.199:/tmp
   mkdir /home/open-falcon
   cd /home/open-falcon
   mv /tmp/falcon-agent-5.1.0.tar.gz .
   tar zxf falcon-agent-5.1.0.tar.gz
   mv cfg.example.json cfg.json && ./control start && ./control tail
   
#5 回到服务端
   cd /home/open-falcon
   mkdir {agent,alarm,dashboard,fe,gateway,graph,hbs,judge,links,portal,query,sender,task,transfer}
   cd /tmp

   tar zxf  falcon-agent-5.1.0.tar.gz -C ../agent
   。。。

   进入各个目录全部启动:  ./control start
   参照手册。。。http://www.jianshu.com/p/a5fcd5c048f1
   
部署中的问题:
Cleaning up...
Command /home/open-falcon/dashboard/env/bin/python -c "import setuptools;__file__=‘/home/open-falcon/dashboard/env/build/mysql-python/setup.py‘;exec(compile(open(__file__).read().replace(‘\r\n‘, ‘\n‘), __file__, ‘exec‘))" install --record /tmp/pip-VycJSx-record/install-record.txt --single-version-externally-managed --install-headers /home/open-falcon/dashboard/env/include/site/python2.6 failed with error code 1 in /home/open-falcon/dashboard/env/build/mysql-python
Traceback (most recent call last):
  File "./env/bin/pip", line 9, in <module>
    load_entry_point(‘pip==1.4.1‘, ‘console_scripts‘, ‘pip‘)()
  File "/home/open-falcon/dashboard/env/lib/python2.6/site-packages/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/home/open-falcon/dashboard/env/lib/python2.6/site-packages/pip/basecommand.py", line 169, in main
    text = ‘\n‘.join(complete_log)
UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xe9 in position 20: ordinal not in range(128)



处理办法: 将上面报错的py文件中加上下面三行
import sys
reload(sys)
sys.setdefaultencoding(‘utf-8‘)


问题:error: command ‘gcc‘ failed with exit status 1
yum groupinstall -y development
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel libxslt-devel libffi-devel


#6 处理高并发
1. 分片:一台机器抗不住就分成多台机器,数人云是一个 PaaS 平台,PaaS 平台很容易做扩容,原来三百台实例现在做三千台,在页面上按键按一下,10 秒就可以让 3000 台实例起来,做 3000 个分片。


2. 队列:有时候产生一些峰值,我们不希望被峰值打垮,于是用队列做缓冲,这个系统有多个地方用到队列,比如 transfer 内存中构建了多条队列,报警事件使用 Redis 做队列服务。


3. 索引:索引可以加快查询速度。


4. 限流:后端的接口抗不住压力的时候会做限流。

本文出自 “开发与运维” 博客,谢绝转载!

玩转open-falcon