Grafana最新版本4.3.1安装(后端使用mysql)
环境
CentOS release 6.5 (Final) 64bit
zabbix_server (Zabbix) 3.0.3
grafana-4.3.1
mysql-5.6.21
一、安装grafana
安装方法有很多,官网有介绍:http://docs.grafana.org/installation/rpm/。我这里采用二进制安装方法。
1、下载二进制包,安装
[root@localhost src]# rpm -Uvh grafana-4.3.1-1.x86_64.rpm
warning: grafana-4.3.1-1.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 24098cb6: NOKEY
Preparing... ########################################### [100%]
1:grafana ########################################### [100%]
### NOT starting grafana-server by default on bootup, please execute
sudo /sbin/chkconfig --add grafana-server
### In order to start grafana-server, execute
sudo service grafana-server start
POSTTRANS: Running script
2、修改grafana.ini文件
参考连接http://docs.grafana.org/installation/configuration/
因为默认使用sqlite3,我这里把他替换成mysql,因为我对mysql熟悉些,而且考虑到以后备份、异常恢复啥的。
修改配置:database和session都替换成mysql数据库。
############################### Database ####################################
[database]
# You can configure the database connection by specifying type, host, name, user and password
# as seperate properties or as on string using the url propertie.
# Either "mysql", "postgres" or "sqlite3", it's your choice
type = mysql
host = 127.0.0.1:3306
name = grafana
user = grafana
password = grafana
################################# Session #################################
[session]
provider = mysql
provider_config = grafana:grafana@tcp(127.0.0.1:3306)/grafana
cookie_name = grafana_session
cookie_secure = false
session_life_time = 86400
3、建库
CREATE DATABASE grafana DEFAULT CHARACTER SET utf8;
GRANT ALL ON grafana.* TO grafana@'localhost' IDENTIFIED BY 'grafana' WITH GRANT OPTION;
FLUSH PRIVILEGES;
4、启动服务grafana-server
启动服务时,出了个小插曲。启动服务的时候,失败了。
[root@localhost ~]# /etc/init.d/grafana-server restart
Stopping Grafana Server: ...[FAILED]
Starting Grafana Server: ... [ OK ]
FAILED
解决过程:查log。
[root@localhost grafana]# tail -f /var/log/grafana/grafana.log
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="create index UQE_user_email - v2"
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="copy data_source v1 to v2"
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="Drop old table user_v1"
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="Add column help_flags1 to user table"
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="Update user table charset"
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="create temp user table v1-7"
t=2017-06-22T11:26:03+0800 lvl=info msg="Executing migration" logger=migrator id="create index IDX_temp_user_email - v1-7"
t=2017-06-22T11:26:03+0800 lvl=eror msg="Executing migration failed" logger=migrator id="create index IDX_temp_user_email - v1-7" error="Error 1071: Specified key was too long; max key length is 767 bytes"
t=2017-06-22T11:26:03+0800 lvl=eror msg="Exec failed" logger=migrator error="Error 1071: Specified key was too long; max key length is 767 bytes" sql="CREATE INDEX `IDX_temp_user_email` ON `temp_user` (`email`);"
t=2017-06-22T11:26:03+0800 lvl=eror msg="Fail to initialize orm engine" logger=sqlstore error="Sqlstore::Migration failed err: Error 1071: Specified key was too long; max key length is 767 bytes\n"
根据提示,是在创建索引的时候,长度超过了767bytes导致。在mysql官网查看也可以看到:By default, the index key prefix length limit is 767 bytes.
参考连接https://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html
解决办法:
1、修改my.cnf文件,增加如下变量
my.cnf
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_file_format_max=Barracuda
进入数据库,查看这几个变量的原始值:
mysql> show variables like 'innodb_file%';
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_file_format | Antelope |
| innodb_file_format_check | ON |
| innodb_file_format_max | Antelope |
| innodb_file_per_table | ON |
+--------------------------+----------+
4 rows in set (0.01 sec)
mysql> show variables like 'innodb_large%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| innodb_large_prefix | OFF |
+---------------------+-------+
1 row in set (0.00 sec)
修改my.cnf文件后,重启数据库。
2、修改grafana表的行格式。
temp_user ALTER TABLE temp_user ROW_FORMAT=DYNAMIC;
dashboard ALTER TABLE dashboard ROW_FORMAT=DYNAMIC;
alert ALTER TABLE alert ROW_FORMAT=DYNAMIC;
修改前:
mysql> SHOW TABLE STATUS like 'dashboard'\G
*************************** 1. row ***************************
Name: dashboard
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 21
Avg_row_length: 60074
Data_length: 1261568
Max_data_length: 0
Index_length: 65536
Data_free: 4194304
Auto_increment: 44
Create_time: 2016-07-13 11:07:01
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
mysql> ALTER TABLE dashboard ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.17 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> ALTER TABLE dashboard ROW_FORMAT=DYNAMIC;
Query OK, 0 rows affected (0.17 sec)
Records: 0 Duplicates: 0 Warnings: 0
修改后:
mysql> SHOW TABLE STATUS like 'dashboard'\G
*************************** 1. row ***************************
Name: dashboard
Engine: InnoDB
Version: 10
Row_format: Dynamic
Rows: 22
Avg_row_length: 72238
Data_length: 1589248
Max_data_length: 0
Index_length: 65536
Data_free: 0
Auto_increment: 44
Create_time: 2017-05-24 12:01:03
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options: row_format=DYNAMIC
Comment:
3、重启grafana服务,一切OK。
t=2017-06-22T11:39:21+0800 lvl=info msg="Starting Grafana" logger=main version=4.3.1 commit=befc15c compiled=2017-05-23T21:50:22+0800
t=2017-06-22T11:39:21+0800 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2017-06-22T11:39:21+0800 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2017-06-22T11:39:21+0800 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2017-06-22T11:39:21+0800 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2017-06-22T11:39:21+0800 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2017-06-22T11:39:21+0800 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2017-06-22T11:39:21+0800 lvl=info msg="Path Data" logger=settings path=/var/lib/grafana
t=2017-06-22T11:39:21+0800 lvl=info msg="Path Logs" logger=settings path=/var/log/grafana
t=2017-06-22T11:39:21+0800 lvl=info msg="Path Plugins" logger=settings path=/var/lib/grafana/plugins
t=2017-06-22T11:39:21+0800 lvl=info msg="Initializing DB" logger=sqlstore dbtype=mysql
t=2017-06-22T11:39:21+0800 lvl=info msg="Starting DB migration" logger=migrator
t=2017-06-22T11:39:21+0800 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
t=2017-06-22T11:39:21+0800 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
t=2017-06-22T11:39:21+0800 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
t=2017-06-22T11:39:21+0800 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
t=2017-06-22T11:39:21+0800 lvl=info msg="Executing migration" logger=migrator id="add index alert state"
t=2017-06-22T11:39:21+0800 lvl=info msg="Executing migration" logger=migrator id="add index alert dashboard_id"
t=2017-06-22T11:39:21+0800 lvl=info msg="Executing migration" logger=migrator id="create alert_notification table v1"
t=2017-06-22T11:39:21+0800 lvl=info msg="Executing migration" logger=migrator id="Add column is_default"
t=2017-06-22T11:39:22+0800 lvl=info msg="Executing migration" logger=migrator id="add index alert_notification org_id & name"
t=2017-06-22T11:39:22+0800 lvl=info msg="Executing migration" logger=migrator id="Update alert table charset"
t=2017-06-22T11:39:22+0800 lvl=info msg="Executing migration" logger=migrator id="Update alert_notification table charset"
t=2017-06-22T11:39:22+0800 lvl=info msg="Executing migration" logger=migrator id="Drop old annotation table v4"
t=2017-06-22T11:39:22+0800 lvl=info msg="Executing migration" logger=migrator id="create annotation table v5"
t=2017-06-22T11:39:23+0800 lvl=info msg="Executing migration" logger=migrator id="add index annotation 0 v3"
t=2017-06-22T11:39:23+0800 lvl=info msg="Executing migration" logger=migrator id="add index annotation 1 v3"
t=2017-06-22T11:39:23+0800 lvl=info msg="Executing migration" logger=migrator id="add index annotation 2 v3"
t=2017-06-22T11:39:23+0800 lvl=info msg="Executing migration" logger=migrator id="add index annotation 3 v3"
t=2017-06-22T11:39:23+0800 lvl=info msg="Executing migration" logger=migrator id="add index annotation 4 v3"
t=2017-06-22T11:39:23+0800 lvl=info msg="Executing migration" logger=migrator id="Update annotation table charset"
t=2017-06-22T11:39:24+0800 lvl=info msg="Executing migration" logger=migrator id="Add column region_id to annotation table"
t=2017-06-22T11:39:24+0800 lvl=info msg="Executing migration" logger=migrator id="create test_data table"
t=2017-06-22T11:39:25+0800 lvl=info msg="Created default admin user: admin"
t=2017-06-22T11:39:25+0800 lvl=info msg="Starting plugin search" logger=plugins
t=2017-06-22T11:39:25+0800 lvl=warn msg="Plugin dir does not exist" logger=plugins dir=/var/lib/grafana/plugins
t=2017-06-22T11:39:25+0800 lvl=info msg="Plugin dir created" logger=plugins dir=/var/lib/grafana/plugins
t=2017-06-22T11:39:25+0800 lvl=info msg="Initializing Alerting" logger=alerting.engine
t=2017-06-22T11:39:25+0800 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2017-06-22T11:39:25+0800 lvl=info msg="Initializing Stream Manager"
t=2017-06-22T11:39:25+0800 lvl=info msg="Initializing HTTP Server" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
5、打开主页
PS:本文纯属记录个人实践经历,如有问题,可随时联系我。QQ505711559
Grafana最新版本4.3.1安装(后端使用mysql)的更多相关文章
- 安装最新版本的kubernets(+安装插件dashboard)
一.安装docker // 安装系统工具: sudo yum install -y yum-utils device-mapper-persistent-data lvm2 // 添加docker y ...
- Git 最新版本2.20.1 安装及配置
我们先去官网下载地址,去下载. https://git-scm.com/downloads 1. 2. 3. 双击 Git-2.20.1-64-bit.exe 安装 4. 5. 6. 7. 8. 9. ...
- 最新版本2018.1.1webstorm安装、汉化、破解教程
一.安装(下载与激活) 1.官网下载安装包https://www.jetbrains.com/webstorm/ 2.开始安装 3.选择安装目录,点击下一步 4.勾选64位,点击下一步 5.继续下一步 ...
- Ruby windows7安装配置(最新版本)
1.下载最新版本的rubyinstaller并安装http://rubyinstaller.org/downloads/ 如下图所示设置路径,我安装时将所有选项都打够了,免除了后面需要什么配置麻烦. ...
- Kubernetes 1.13.3 部署 Prometheus+Grafana-7.5.2(最新版本踩坑)
本教程直接在 Kubernetes 1.13.3 版本上安装 Prometheus 和 Grafana-7.5.2,至于它们的原理和概念就不再赘述,这里就直接开始操作. Git 下载相关 YAML 文 ...
- 最新版本elasticsearch本地搭建入门篇
最新版本elasticsearch本地搭建入门篇 项目介绍 最近工作用到elasticsearch,主要是用于网站搜索,和应用搜索. 工欲善其事,必先利其器. 自己开始关注elasticsearch, ...
- Linux CentOS6系统安装最新版本Node.js环境及相关文件配置
Node.js,当前应用非常广泛的Javascript运行环境,采用C++编写的,目前应用较多的用于WEB应用中,执行效率还是非常高的,虽然老左不从业程序的开发,但是有些时候在玩VPS的时候还是会遇到 ...
- ABP开发框架前后端开发系列---(16)ABP框架升级最新版本的经验总结
有一小段时间没有持续升级ABP框架了,最近就因应客户的需要,把ABP框架进行全面的更新,由于我们应用的ABP框架,基础部分还是会使用官方的内容,因此升级的时候需要把官方基础ABP的DLL进行全面的更新 ...
- ubuntu14.04下配置Java环境以及安装最新版本的eclipse
首先是配置JDK 步骤一:下载最新版本的JDK,链接:http://www.oracle.com/technetwork/java/javase/downloads/index.html 步骤二:首先 ...
随机推荐
- linux应用态下的时间
1.时间值 1.1 日历时间(UTC) 该值是自1 9 7 0年1月1日0 0 : 0 0 : 0 0以来国际标准时间( U T C)所经过的秒数累计值(早期的手册称 U T C为格林尼治标准时间) ...
- CS:APP3e 深入理解计算机系统_3e Attacklab 实验
详细的题目要求和资源可以到 http://csapp.cs.cmu.edu/3e/labs.html 或者 http://www.cs.cmu.edu/~./213/schedule.html 获取. ...
- CentOS 7 学习(三)配置Tomcat集群
所谓集群,就是把多台服务器集合起来,对外提供一个接口访问,对用户来说完全透明,常用的办法就是前端放一个服务器,将用户请求分发到不同的服务器,大致有以下几种方案 1)采取DNS轮询:将用户的连接解析到不 ...
- Javascript中的Microtask和Macrotask——从一道很少有人能答对的题目说起
首先我们来看一道题目,如下javascript代码,执行后会在控制台打印出什么内容? async function async1() { console.log('async1 start'); aw ...
- MVC系列——一个异常消息传递引发的思考
前言:最近在某个项目里面遇到一个有点纠结的小问题,经过半天时间的思索和尝试,问题得到解决.在此记录一下解决的过程,以及解决问题的过程中对.net里面MVC异常处理的思考.都是些老生常谈的问题,不多说, ...
- IDS 源镜像端口添加
把核心交换机的G1/2口镜像到目的交换机的G1/4口,两个交换机之间都是连接的24口 1.核心交换机配置 Ruijie# configure tRuijie(config)# vlan 77Ruiji ...
- html5 canvas画布尺寸与显示尺寸
我在用canvas制作画板时,遇到了绘图位置和鼠标位置不一致的问题,所以今天查阅了一下资料,解决了这个问题. canvas绘图原理 在Canvas元素的内部存在一个名为2d渲染环境(2d rederi ...
- (通用)深度学习环境搭建:tensorflow安装教程及常见错误解决
区别于其他入门教程的"手把手式",本文更强调"因"而非"果".我之所以加上"通用"字样,是因为在你了解了这个开发环境之后 ...
- css scroll bug
滚动区域不能设置overflow var doc = $(document), win = $(window), h = $("#head"), b = $("#body ...
- 由浅入深理解Java线程池及线程池的如何使用
前言 多线程的异步执行方式,虽然能够最大限度发挥多核计算机的计算能力,但是如果不加控制,反而会对系统造成负担.线程本身也要占用内存空间,大量的线程会占用内存资源并且可能会导致Out of Memory ...