• ADADADADAD

    open-falcon搭建[ mysql数据库 ]

    mysql数据库 时间:2024-12-25 09:57:27

    作者:文/会员上传

    简介:

    环境准备yum install -y redisyuminstall-ymysql-server###安装并开机自启###
    exportHOME=/home/workexportWORKSPACE=$HOME/open-falconmkdir-p$WORKSPACEcd$WORKSPACEgitc

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    环境准备

    yum install -y redis

    yuminstall-ymysql-server
    ###安装并开机自启###

    exportHOME=/home/work
    exportWORKSPACE=$HOME/open-falcon
    mkdir-p$WORKSPACE
    cd$WORKSPACE
    gitclonehttps://github.com/open-falcon/scripts.git
    cd./scripts/
    mysql-hlocalhost-uroot--password=""<db_schema/graph-db-schema.sql
    mysql-hlocalhost-uroot--password=""<db_schema/dashboard-db-schema.sql

    mysql-hlocalhost-uroot--password=""<db_schema/portal-db-schema.sql
    mysql-hlocalhost-uroot--password=""<db_schema/links-db-schema.sql
    mysql-hlocalhost-uroot--password=""<db_schema/uic-db-schema.sql

    ####数据库密码为空####

    mkdir./tmp

    导入安装包open-falcon-v0.1.0.tar.gz

    Shell脚本执行

    tar-zxfopen-falcon-latest.tar.gz-C./tmp/
    forxin`find./tmp/-name"*.tar.gz"`;do\
    app=`echo$x|cut-d'-'-f2`;\
    mkdir-p$app;\
    tar-zxf$x-C$app;\
    done

    安装go环境

    cd~
    wgethttp://dinp.qiniudn.com/go1.4.1.linux-amd64.tar.gz
    tarzxfgo1.4.1.linux-amd64.tar.gz
    mkdir-pworkspace/src
    echo"">>.bashrc
    echo'exportGOROOT=$HOME/go'>>.bashrc
    echo'exportGOPATH=$HOME/workspace'>>.bashrc
    echo'exportPATH=$GOROOT/bin:$GOPATH/bin:$PATH'>>.bashrc
    echo"">>.bashrc
    source.bashrc

    接下来clone代码,以备后用

    cd$GOPATH/src
    mkdirgithub.com
    cdgithub.com
    gitclone--recursivehttps://github.com/open-falcon/of-release.git

    安装agent(采集机器监控指标)

    cd$GOPATH/src/github.com/open-falcon/agent

    ###所有组件配置文件必须叫cfg.json,可以基于cfg.example.json修改

    ./controlstart启动进程
    ./controlstop停止进程
    ./controlrestart重启进程
    ./controlstatus查看进程状态
    ./controltail用tail-f的方式查看var/app.log
    ./falcon-agent–check检查是否可以正常跑在当前机器


    安装Transfer(数据转发服务)
    Cdtransfer
    vimcfg.json

    {
    "debug":false,
    "minStep":30,
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:6060"
    },
    "rpc":{
    "enabled":true,
    "listen":"0.0.0.0:8433"
    },
    "socket":{
    "enabled":false,
    "listen":"0.0.0.0:4444",
    "timeout":3600
    },
    "judge":{
    "enabled":true,
    "batch":200,
    "connTimeout":1000,
    "callTimeout":5000,
    "maxConns":32,
    "maxIdle":32,
    "replicas":500,
    "cluster":{
    "judge-00":"127.0.0.1:6080"
    }
    },
    "graph":{
    "enabled":true,
    "batch":200,
    "connTimeout":1000,
    "callTimeout":5000,
    "maxConns":32,
    "maxIdle":32,
    "replicas":500,
    "cluster":{
    "graph-00":"127.0.0.1:6070"
    }
    },
    "tsdb":{
    "enabled":true,
    "batch":200,
    "connTimeout":1000,
    "callTimeout":5000,
    "maxConns":32,
    "maxIdle":32,
    "retry":3,
    "address":"127.0.0.1:8088"
    }
    }

    启动
    ./controlstart
    curl-s"127.0.0.1:6060/health"校验

    cdgraph
    mvcfg.example.jsoncfg.json
    vimcfg.json
    {
    "debug":false,
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:6071"
    },
    "rpc":{
    "enabled":true,
    "listen":"0.0.0.0:6070"
    },
    "rrd":{
    "storage":"/home/work/data/6070"
    },
    "db":{
    "dsn":"root:@tcp(127.0.0.1:3306)/graph?loc=Local&parseTime=true",
    "maxIdle":4
    },
    "callTimeout":5000,
    "migrate":{
    "enabled":false,
    "concurrency":2,
    "replicas":500,
    "cluster":{
    "graph-00":"127.0.0.1:6070"
    }
    }
    }

    ./controlstart
    curl-s"127.0.0.1:6071/health"

    cd../queph
    mvcfg.example.jsoncfg.json
    vimcfg.json
    {
    "debug":"false",
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:9966"
    },
    "graph":{
    "connTimeout":1000,
    "callTimeout":5000,
    "maxConns":32,
    "maxIdle":32,
    "replicas":500,
    "cluster":{
    "graph-00":"127.0.0.1:6070"
    }
    },
    "api":{
    "query":"http://127.0.0.1:9966",
    "dashboard":"http://127.0.0.1:8081",
    "max":500
    服务启动后,可以通过日志查看服务的运行状态,日志文件地址为./var/app.log。可以通过查询脚本./scripts/query读取绘图数据,如运行bash./scripts/query"ur.endpoint""ur.counter"可以查询Endpoint="ur.endpoint"&Counter="ur.counter"对应的绘图数据。

    注意:请确保graph.replicas和graph.cluster的内容与transfer的配置完全一致


    安装dashboard
    yuminstall-ypython-virtualenv
    cd/path/to/dashboard/
    virtualenv./env
    ./env/bin/pipinstall-rpip_requirements.txt
    ###这里MySQL-Python会出错。在pip_requirements.txt里去掉MySQL-Python单独安装。参考地址:http://blog.csdn.net/winsonyuan/article/details/65447796

    vim./gunicorn.conf
    vim./rrd/config.py

    workers=4
    bind=':8081'
    proc_name='falcon-dashboard-opensource'
    pidfile='/tmp/falcon-dashboard-opensource.pid'
    limit_request_field_size=0
    limit_request_line=0

    #-*-coding:utf8-*-
    importos

    #--dashboarddbconfig--
    DASHBOARD_DB_HOST="127.0.0.1"
    DASHBOARD_DB_PORT=3306
    DASHBOARD_DB_USER="root"
    DASHBOARD_DB_PASSWD=""
    DASHBOARD_DB_NAME="dashboard"

    #--graphdbconfig--
    GRAPH_DB_HOST="127.0.0.1"
    GRAPH_DB_PORT=3306
    GRAPH_DB_USER="root"
    GRAPH_DB_PASSWD=""
    GRAPH_DB_NAME="graph"

    #--appconfig--
    DEBUG=True
    SECRET_KEY="secret-key"
    SESSION_COOKIE_NAME="open-falcon"
    PERMANENT_SESSION_LIFETIME=3600*24*30
    SITE_COOKIE="open-falcon-ck"

    #--queryconfig--
    QUERY_ADDR="http://127.0.0.1:9966"

    BASE_DIR="/home/work/open-falcon/dashboard/"
    LOG_PATH=os.path.join(BASE_DIR,"log/")

    try:
    fromrrd.local_configimport*
    except:
    pass

    邮件短信接口这里需要单独安装falcon-mail-provider的安装包
    {
    "debug":true,
    "http":{
    "listen":"10.0.0.60:4000",
    "token":""
    },
    "smtp":{
    "addr":"smtp.qq.com:587",
    "username":"XXXX@qq.com",
    "password":"eahqkylmljenbfge",==》这里有个授权码问题。
    "from":"XXXX@qq.com"
    }
    }
    ~./controlstart

    发送一份测试邮件:curlhttp://10.0.0.60:4000/sender/mail-dtos=XXXX@qq.com&subject=helloworld&content=test

    安装sender(调用公司提供的邮件、短信接口)
    Cdsender
    Vicfg.json
    {
    "debug":true,
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:6066"
    },
    "redis":{
    "addr":"127.0.0.1:6379",
    "maxIdle":5
    },
    "queue":{
    "sms":"/sms",
    "mail":"/mail"
    },
    "worker":{
    "sms":10,
    "mail":50
    },
    "api":{
    "sms":"http://10.0.0.60:8000/sms",
    "mail":"http://10.0.0.60:4000/sender/mail"
    }
    }

    curl127.0.0.1:6066/health

    安装FE(UICweb入口)
    Cdfe
    Vicfg.json
    {
    "log":"debug",
    "company":"PJwuliu",==》这里是公司名称用于生成二维码
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:1234"
    },
    "cache":{
    "enabled":true,
    "redis":"127.0.0.1:6379",
    "idle":10,
    "max":1000,
    "timeout":{
    "conn":10000,
    "read":5000,
    "write":5000
    }
    },
    "salt":"fdfdfdsfsdfsfdsfs",
    "canRegister":true,
    "ldap":{
    "enabled":false,
    "addr":"ldap.example.com:389",
    "baseDN":"dc=example,dc=com",
    "bindDN":"cn=mananger,dc=example,dc=com",
    "bindPasswd":"12345678",
    "userField":"uid",
    "attributes":["sn","mail","telephoneNumber"]
    },
    "uic":{
    "addr":"root:@tcp(127.0.0.1:3306)/uic?charset=utf8&loc=Asia%2FChongqing",
    "idle":10,
    "max":100
    },
    "shortcut":{
    "falconPortal":"http://10.0.0.60:5050/",
    "falconDashboard":"http://10.0.0.60:8081/",
    "falconAlarm":"http://10.0.0.60:9912/"
    }

    安装portal(配置报警策略)
    #yuminstall-ypython-virtualenv

    $cd/path/to/portal/
    $virtualenv./env

    $./env/bin/pipinstall-rpip_requirements.txt
    vi../portal/frame/config.py
    #-*-coding:utf-8-*-
    __author__='UlricQin'

    #--appconfig--
    DEBUG=True

    #--dbconfig--
    DB_HOST="127.0.0.1"
    DB_PORT=3306
    DB_USER="root"
    DB_PASS=""
    DB_NAME="falcon_portal"

    #--cookieconfig--
    SECRET_KEY="4e.5tyg8-u9iojds"
    SESSION_COOKIE_NAME="falcon-portal"
    PERMANENT_SESSION_LIFETIME=3600*24*30

    UIC_ADDRESS={
    'internal':'http://10.0.0.60:1234',
    'external':'http://10.0.0.60:1234',
    }

    UIC_TOKEN=''

    MAINTAINERS=['root']
    CONTACT='ulric.qin@gmail.com'

    COMMUNITY=True

    try:
    fromframe.local_configimport*
    exceptException,e:
    print"[warning]%s"%e

    cdhbs

    {
    "debug":true,
    "database":"root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
    "hosts":"",
    "maxIdle":100,
    "listen":":6030",
    "trustable":[""],
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:6031"
    }
    }

    Cdjudge~(告警判断)
    {
    "debug":true,
    "debugHost":"nil",
    "remain":11,
    "http":{
    "enabled":true,
    "listen":"10.0.0.60:6081"
    },
    "rpc":{
    "enabled":true,
    "listen":"0.0.0.0:6080"
    },
    "hbs":{
    "servers":["10.0.0.60:6030"],
    "timeout":300,
    "interval":60
    },
    "alarm":{
    "enabled":true,
    "minInterval":300,
    "queuePattern":"event:p%v",
    "redis":{
    "dsn":"127.0.0.1:6379",
    "maxIdle":5,
    "connTimeout":5000,
    "readTimeout":5000,
    "writeTimeout":5000
    }
    }
    }

    curl127.0.0.1:6081/health

    cdlinks
    virtualenv./env

    ./env/bin/pipinstall-rpip_requirements.txt

    #-*-coding:utf-8-*-
    __author__='UlricQin'

    #--appconfig--
    DEBUG=True

    #--dbconfig--
    DB_HOST="10.0.0.60"
    DB_PORT=3306
    DB_USER="root"
    DB_PASS=""
    DB_NAME="falcon_links"

    #--cookieconfig--
    SECRET_KEY="4e.5tyg8-u9ioj"
    SESSION_COOKIE_NAME="falcon-links"
    PERMANENT_SESSION_LIFETIME=3600*24*30

    try:
    fromframe.local_configimport*
    exceptException,e:
    print"[warning]%s"%e

    安装alarm(处理报警event),judge产生的报警event写入redis,alarm从redis读取处理

    {
    "debug":true,
    "uicToken":"",
    "http":{
    "enabled":true,
    "listen":"10.0.0.60:9912"
    },
    "queue":{
    "sms":"/sms",
    "mail":"/mail"
    },
    "redis":{
    "addr":"127.0.0.1:6379",
    "maxIdle":5,
    "highQueues":[
    "event:p0",
    "event:p1",
    "event:p2",
    "event:p3",
    "event:p4",
    "event:p5"
    ],
    "lowQueues":[
    "event:p6"
    ],
    "userSmsQueue":"/queue/user/sms",
    "userMailQueue":"/queue/user/mail"
    },
    "api":{
    "portal":"http://10.0.0.60:5050",
    "uic":"http://10.0.0.60:1234",
    "links":"http://10.0.0.60:5090"
    }
    }

    安装task(定时任务)
    {
    "debug":false,
    "http":{
    "enable":true,
    "listen":"0.0.0.0:8002"
    },
    "index":{
    "enable":false,
    "dsn":"root:root@tcp(127.0.0.1:3306)/graph?loc=Local&parseTime=true",
    "maxIdle":4,
    "autoDelete":false,
    "cluster":{
    "test.hostname01:6071":"000?*0-5",
    "test.hostname02:6071":"0300?*0-5"
    }
    },
    "collector":{
    "enable":true,
    "destUrl":"http://127.0.0.1:1988/v1/push",
    "srcUrlFmt":"http://%s/statistics/all",
    "cluster":[
    "transfer,open-falcon.te:6060",
    "graph,open-falcon.te:6071",
    "task,open-falcon.te:8001"
    ]
    }
    }

    安装nodata(监测监控数据的上报异常)
    {
    "debug":true,
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:6090"
    },
    "query":{
    "connectTimeout":5000,
    "requestTimeout":30000,
    "queryAddr":"127.0.0.1:9966"
    },
    "config":{
    "enabled":true,
    "dsn":"root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true&wait_timeout=604800",
    "maxIdle":4
    },
    "collector":{
    "enabled":true,
    "batch":200,
    "concurrent":10
    },
    "sender":{
    "enabled":true,
    "connectTimeout":5000,
    "requestTimeout":30000,
    "transferAddr":"127.0.0.1:6060",
    "batch":500,
    "block":{
    "enabled":false,
    "threshold":32
    }
    }
    }

    安装aggregator(集群聚合模块)
    {
    "debug":true,
    "http":{
    "enabled":true,
    "listen":"0.0.0.0:6055"
    },
    "database":{
    "addr":"root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
    "idle":10,
    "ids":[1,-1],
    "interval":55
    },
    "api":{
    "hostnames":"http://127.0.0.1:5050/api/group/%s/hosts.json",
    "push":"http://127.0.0.1:6060/api/push",
    "graphLast":"http://127.0.0.1:9966/graph/last"
    }
    }至此open-falcon已经搭建完成。现在open-falcon刚发布不久plus版,有时间再去看看吧!祝玩的开心!!!官网地址:https://github.com/open-falcon-archive/of-release
    open-falcon搭建.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: openfalconfalcocon