1、预安装
- nodejs 8.11.4
- yarn latest版本 npm install -g yarn@1.7.0—全局安装yarn,高版本yarn容易报错
- 对应版本的es,本地安装的是6.4.1版本的es
- 设置淘宝镜像
yarn config set registry https://registry.npm.taobao.org/ npm config set registry https://registry.npm.taobao.org/
高版本yarn安装依赖时报错
Installing dependencies in [@kbn/ui-framework]:
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/4] ⡀ waiting...
[2/4] ⡀ node-sass
[-/4] ⡀ waiting...
error /home/op/ulog_kibana/packages/kbn-ui-framework/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: /home/op/ulog_kibana/packages/kbn-ui-framework/node_modules/node-sass
版本信息可在package.json文件中查看
编译
1、下载kibana源码https://github.com/elastic/kibana
2、切换到v.6.4.1tag 直接下载zip包,解压后在安装目录打开git bash(windows)
3、执行yarn kbn bootstrap
安装依赖
4、安装完依赖执行命令
sh ./bin/kibana --dev --no-watch
,命令解释如下
5、启动成功
6、经常会由于网络原因导致yarn kbn bootstrap
失败,此时多次执行它或者执行yarn install --network-concurrency 1
7、在多次尝试下,yarn install --network-concurrency 1
成功率比较高,可以先执行这个,然后执行yarn kbn bootstrap
连接es
config目录下的配置文件kibana.yml中设置以下属性的值
server.port: 5601 //使用默认端口号
server.host: "localhost" //kibana访问ip地址
server.basePath: "/kibana_test" //kibana访问地址后缀固定
elasticsearch.url: "http://localhost:9200" //es连接地址
elasticsearch.username: "es连接账号名称"
elasticsearch.password: "es连接账号密码"
kibana.defaultAppId: "discover" //kibana登录后默认显示页为discover页
kibana免密登录,借助nginx做账号密码输入。
1、kibana.yml设置如下配置
elasticsearch.requestHeadersWhitelist: [authorization] //es连接使用authorization中的账密进行连接
2、客户端nginx配置如下
upstream kibana_test_server {
server 127.0.0.1:5601;
}
……
location /kibana_test/ {
proxy_pass http://kibana_test_server/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Authorization "Basic base64编码后字符串"; //base64(账号:密码)
}