grafana install

mysql install

1
mysql 已经安装

grafana install

  1. 在数据库创建grafana库

    1
    2
    3
    4
    [root@10 ~]# /mnt/app/mysql/bin/mysql -S /mnt/data/mysql/mysql.sock
    mysql> create database grafana DEFAULT CHARACTER SET utf8;
    mysql> GRANT ALL ON grafana.* TO 'grafana'@'10.0.2.113' IDENTIFIED BY "grafana123";
    mysql> flush privileges;
  2. grafana 安装

    1
    2
    3
    4
    5
    6
    7
    [root@10 ~]# cd /mnt/ops/app/
    [root@10 app]# tar xzf grafana-4.0.1-1480694114.linux-x64.tar.gz
    [root@10 app]# mv grafana-4.0.1-1480694114 /mnt/app/grafana
    [root@10 app]# chown -R wisdom.wisdom /mnt/app/grafana

    [root@10 ~]# mkdir -p /mnt/{data,log}/grafana
    [root@10 ~]# chown -R wisdom.wisdom /mnt/{data,log}/grafana
  3. grafana 配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    [root@10 ~]# cp /mnt/app/grafana/conf/{defaults.ini,grafana.ini}
    [root@10 ~]# vim /mnt/app/grafana/conf/grafana.ini
    instance_name = 10.0.2.113
    [paths]
    data = /mnt/data/grafana
    logs = /mnt/log/grafana
    plugins = /mnt/app/grafana/data/plugins
    [database]
    type = mysql
    host = 10.0.2.113:3306
    name = grafana
    user = grafana
    password = grafana123
    url = mysql://grafana:grafana123@10.0.2.113:3306/grafana
    ssl_mode = disable
    ca_cert_path =
    client_key_path =
    client_cert_path =
    server_cert_name =
    path = grafana.db
    [session]
    provider = file
    1
    2
    3
    4
    5
    6
    7
    数据库选择:sqlit3
    [root@10 app]# mkdir /mnt/data/sqlite3
    [root@10 app]# chown -R wisdom.wisdom /mnt/data/sqlite3
    [database]
    type = sqlite3
    path = /mnt/data/sqlite3/grafana.db
    name = grafana
  4. grafana 启动

    1
    2
    [root@10 ~]# su - wisdom
    [wisdom@10 ~]$ /mnt/app/grafana/bin/grafana-server -homepath /mnt/app/grafana/ -config /mnt/app/grafana/conf/grafana.ini -pidfile /mnt/data/grafana/grafana.pid &
  5. grafana 登录和配置

    1
    2
    //浏览器中输入,进行配置
    http://101.200.45.206:3000/login admin:admin