日志分析 第七章 安装grafana

grafana依赖mysql存储数据,首先需要安装mysql

安装mysql

解压

# groupadd mysql
# useradd -s /sbin/nologin -g mysql mysql
# tar xf mysql-5.6..tar.gz -C /usr/local/src/

编译参数

# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/app/mysql-5.6. \
-DMYSQL_DATADIR=/data/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DENABLED_LOCAL_INFILE= \
-DWITH_INNOBASE_STORAGE_ENGINE= \
-DWITH_ARCHIVE_STORAGE_ENGINE= \
-DWITH_BLACKHOLE_STORAGE_ENGINE= \
-DWITH_FEDERATED_STORAGE_ENGINE= \
-DWITH_EXAMPLE_STORAGE_ENGINE= \
-DWITH_PARTITION_STORAGE_ENGINE= \
-DWITH_MYISAM_STORAGE_ENGINE= \
-DWITH_PERFSCHEMA_STORAGE_ENGINE= \
-DMYSQL_TCP_PORT= \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql -DWITH_DEBUG= \

编译参数

编译

# make –j
# make install
# mkdir /data/mysql

初始化

# cp support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chkconfig --add mysqld

启动脚本

# chown -R root.mysql /usr/local/mysql
# chown -R mysql.mysql /data/mysql
# yum install wget ncurses-devel
#./scripts/mysql_install_db --user=mysql --basedir=/usr/local/app/mysql-5.6. --datadir=/data/mysql

PATH、头文件、库文件及man帮助文档配置

# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
# echo "/usr/local/mysql/lib/" >> /etc/ld.so.conf
# ln -sv /usr/local/mysql/include/ /usr/include/mysql
# echo "MANPATH /usr/local/mysql/man" >> /etc/man.config

设置密码

# mysqladmin -uroot password '81-ES-BJVM'

安全设置

mysql> drop database test;
mysql> drop user ''@'BJVM-ES-81';
mysql> drop user ''@'localhost';
mysql> drop user 'root'@'::1';
mysql> drop user ''@'BJVM-ES-81';

安装grafana

[root@elk ~]# tar xf grafana-3.1.-.linux-x64.tar.gz
[root@elk ~]# tar xf grafana-3.1.-.linux-x64.tar.gz -C /usr/local/app/
[root@elk ~]# ln -sv /usr/local/app/grafana-3.1.- /usr/local/grafana
[root@elk ~]# cd /usr/local/grafana

修改配置文件custom.ini

# cp conf/defaults.ini conf/custom.ini

data = /data/grafana/data
logs =/data/grafana/log
plugins = /data/grafana/plugins
http_addr = 10.80.2.156
type = mysql
host = 10.80.2.81:
name = grafana
user = grafana
password =

授权

# mkdir –pv /data/grafana/{data,log,plugins}

# mysql> create database grafana;

# mysql> grant all privileges on grafana.* to grafana@’10.80.2.81’ identified by “”;

上一篇:初识homebrew


下一篇:QT https post请求(QNetworkRequest要设置SSL证书,而SSL证书认证有三种,实测成功)