大数据学习31:Elasticsearch 6.0 和 Elasticsearch header 安装记录
2017-12-02 21:53
519 查看
Elasticsearch 6.0 和 Elasticsearch header 安装记录
一、elasticsearch 6.0 单机安装
a)创建elkuser用户
b)解压
c)创建相关目录
d)进行配置:
e)开始启动
这里报错,需要修改Linux相关配置:
f)再次启动
发现正常。
使用 get 进行测试
control c 中断后
二、elasticsearch header 单机安装
a) 下载head插件文件:
或者
b) 下载Node.js:
------------------------------ hosts文件 151.101.0.133 raw.githubusercontent.com 192.30.255.112 github.com 54.231.40.211 github-production-release-asset-2e65be.s3.amazonaws.com 54.235.82.130 artifacts.elastic.co 34.208.205.7 npmjs.org 151.101.72.162 registry.npmjs.org 104.20.22.46 nodejs.org -----------------------------
调一下时间 ntpdate 202.108.6.95
一、elasticsearch 6.0 单机安装
a)创建elkuser用户
[root@hadoop001 ~]# useradd elkuser #elasticsearch 只能用非 root 启动 [root@hadoop001 elk]# chown -R elkuser.elkuser elasticsearch-6.0.0/ [root@hadoop001 software]# java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
b)解压
[root@hadoop001 elk]# tar -xzvf elasticsearch-6.0.0.tar.gz
c)创建相关目录
[root@hadoop001 elk]# cd elasticsearch-6.0.0/ [root@hadoop001 elasticsearch-6.0.0]# ll total 236 drwxr-xr-x. 2 root root 4096 Dec 2 15:09 bin drwxr-xr-x. 2 root root 4096 Nov 11 02:42 config drwxr-xr-x. 2 root root 4096 Nov 11 02:42 lib -rw-r--r--. 1 root root 11358 Nov 11 02:39 LICENSE.txt drwxr-xr-x. 14 root root 4096 Nov 11 02:42 modules -rw-r--r--. 1 root root 193097 Nov 11 02:42 NOTICE.txt drwxr-xr-x. 2 root root 4096 Nov 11 02:42 plugins -rw-r--r--. 1 root root 9326 Nov 11 02:39 README.textile [root@hadoop001 elasticsearch-6.0.0]# mkdir data logs [root@hadoop001 elasticsearch-6.0.0]# cd config/ [root@hadoop001 config]# ll total 16 -rw-rw----. 1 root root 2854 Nov 11 02:40 elasticsearch.yml -rw-rw----. 1 root root 2672 Nov 11 02:40 jvm.options -rw-rw----. 1 root root 5091 Nov 11 02:40 log4j2.properties
d)进行配置:
[root@hadoop001 config]# vi elasticsearch.yml cluster.name: wxk_cluster node.name: node-11 path.data: /opt/software/elk/elasticsearch-6.0.0/data path.logs: /opt/software/elasticsearch-6.0.0/logs network.host: 192.168.137.11 # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # bootstrap.memory_lock: false bootstrap.system_call_filter: false 最后配置这个:否则head无法连接elasticsearch http.cors.enabled: true http.cors.allow-origin: "*"
e)开始启动
[root@hadoop001 elk]# chown -R elkuser.elkuser elasticsearch-6.0.0/ [elkuser@hadoop001 elasticsearch-6.0.0]$ bin/elasticsearch
这里报错,需要修改Linux相关配置:
ERROR: [3] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] [2]: max number of threads [1024] for user [elkuser] is too low, increase to at least [4096] [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] vm.max_map_count 不低于 262144 vm.max_map_count 表示虚拟内存大小,它是一个内核参数。elasticsearch 默认要求 vm.max_map_count 不低于 262144。 [root@hadoop001 ~]# sysctl -w vm.max_map_count=262144 [root@hadoop001 ~]# echo "vm.max_map_count=262144" >> /etc/sysctl.conf [root@hadoop001 ~]# sysctl -p nofile 不低于 65536 [root@hadoop001 ~]# nofile 表示进程允许打开的最大文件数。elasticsearch 进程要求可以打开的最大文件数不低于 65536。 [root@hadoop001 ~]# echo "* soft nofile 65536" >> /etc/security/limits.conf [root@hadoop001 ~]# echo "* hard nofile 131072" >> /etc/security/limits.conf nproc 不低于 2048 nproc 表示最大线程数。elasticsearch 要求最大线程数不低于 2048。 [root@hadoop001 ~]# echo "elkuser soft nproc 4096" >> /etc/security/limits.conf [root@hadoop001 ~]# echo "elkuser hard nproc 4096" >> /etc/security/limits.conf [elkuser@hadoop001 elasticsearch-6.0.0]$ ulimit -u 4096 [root@hadoop001 ~]# reboot
f)再次启动
[elkuser@hadoop001 elasticsearch-6.0.0]$ bin/elasticsearch
发现正常。
使用 get 进行测试
[root@hadoop001 elasticsearch-head-master]# curl -XGET '192.168.137.11:9200/?pretty' { "name" : "node-11", "cluster_name" : "wxk_cluster", "cluster_uuid" : "Gj-aXikKTj2A6WyBQJsqSQ", "version" : { "number" : "6.0.0", "build_hash" : "8f0685b", "build_date" : "2017-11-10T18:41:22.859Z", "build_snapshot" : false, "lucene_version" : "7.0.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }
control c 中断后
[elkuser@hadoop001 elasticsearch-6.0.0]$ bin/elasticsearch -d 使他在后台运行
二、elasticsearch header 单机安装
a) 下载head插件文件:
https://github.com/mobz/elasticsearch-head(下载后上传到服务器) 下载zip包上传
或者
git clone git://github.com/mobz/elasticsearch-head.git(git下载)
b) 下载Node.js:
wget https://nodejs.org/dist/v4.6.1/node-v4.6.1-linux-x64.tar.gz(linux命令直接下载) 或者 https://nodejs.org/dist/(官方网站下载后上传到服务器)[/code]
c)解压[root@hadoop001 elk]# pwd /opt/software/elk [root@hadoop001 elk]# ll total 39392 -rw-r--r--. 1 root root 28017602 Nov 26 18:50 elasticsearch-6.0.0.tar.gz drwxr-xr-x. 6 root root 4096 Sep 15 09:32 elasticsearch-head-master -rw-r--r--. 1 root root 921421 Nov 26 23:45 elasticsearch-head-master.zip -rw-r--r--. 1 root root 11387108 Nov 27 00:20 node-v8.9.1-linux-x64.tar.xz [root@hadoop001 elk]# unzip elasticsearch-head-master.zip [root@hadoop001 elk]# xz -d node-v8.9.1-linux-x64.tar.xz [root@hadoop001 elk]# tar -xvf node-v8.9.1-linux-x64.tar
解压后:[root@hadoop001 elk]# ll total 12 drwxr-xr-x. 7 root root 4096 Nov 11 02:42 elasticsearch-6.0.0 drwxr-xr-x. 6 root root 4096 Sep 15 09:32 elasticsearch-head-master drwxrwxr-x. 6 500 500 4096 Nov 8 04:56 node-v8.9.1-linux-x64
d) 配置node.js环境变量:vim /etc/profile: export NODE_HOME=/opt/software/elk/node-v8.9.1-linux-x64 export PATH=$NODE_HOME/bin:$PATH
执行source /etc/profile使环境变量生效
e) 查看当前head插件目录下有无node_modules/grunt目录:
没有:执行命令创建:npm install grunt –save[root@hadoop001 elasticsearch-head-master]# npm installgrunt --save npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression + grunt@1.0.1 added 92 packages in 46.817s
f)修改服务器监听地址:Gruntfile.js
vi Gruntfile.js 在第93行添加:hostname:’*’
g)修改连接地址:_site/app.jsthis.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.137.11:9200"
h) 安装grunt:
grunt是基于Node.js的项目构建工具,可以进行打包压缩、测试、执行等等的工作,head插件就是通过grunt启动npm install -g grunt-cli
i) 安装head插件:
npm install 或者
使用重定向安装:npm install -g cnpm –registry=https://registry.npm.taobao.org[root@hadoop001 elasticsearch-head-master]# npm install
这里要提前配置好hosts,其实只要下载包完成就可以了,有个单独的进度条下载文件的特别慢,我中断了,后面也没有问题。
报错1:[root@hadoop001 elasticsearch-head-master]# npm install npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
解决方法:vi package.json 修改 "license": "Apache-2.0"
warnings其实可以不用管
报错2:[root@hadoop001 elasticsearch-head-master]# grunt server Loading "Gruntfile.js" tasks...ERROR >> SyntaxError: Unexpected identifier Warning: Task "server" not found. Use --force to continue. Aborted due to warnings.
检查 Gruntfile.js
查看server 那里connect: { server: { options: { port: 9100, base: '.', keepalive: true // 这里添加完了以后没加逗号分隔,修改后正常启动 hostname: '0.0.0.0'
j)启动 grunt server[root@hadoop001 elasticsearch-head-master]# grunt server (node:2235) ExperimentalWarning: The http2 module is an experimental API. Running "connect:server" (connect) task Waiting forever... Started connect web server on http://localhost:9100[/code]
后台运行:nohup grunt server &
这样就可以连接elasticsearch 了。
相关文章推荐
- Elasticsearch学习记录(1.安装,简单的查询,聚合,防止数据重复,冲突控制等)
- Elasticsearch搜索引擎学习记录1-安装
- Elasticsearch中的document数据格式,简单的集群管理,商品的索引的CRUD操作(学习资料记录)
- 【利用python进行数据分析-学习记录】python-matplotlib中Basemap插件的安装
- Elasticsearch搜索引擎学习记录2-数据同步
- ElasticSearch学习问题记录——nested查询不到数据
- elasticsearch 2.4.6 集群+kibana 4.6安装部署学习记录
- 大数据学习33:logstash 和 kibanba 安装以及ELK的联调记录
- Scala学习记录(一):下载,安装
- GDI+ 学习记录(28) 图像颜色的数据格式 - PixelFormat
- VC6 下学习使用Teechart8记录 三 数据库读取与鼠标选取数据
- GDI+ 学习记录(31) 图像颜色变换(TGPImageAttributes)
- 20110215 学习记录2:表单中的get和post区别 & 使用 HttpWebRequest 向网站提交数据
- android数据存储学习记录
- 使用rsync同步镜像服务器数据,安装记录
- (DevExpress2011 学习)XPO 学习之2 --数据记录增 删 改 与继承
- RHCE 6.0 学习笔记-1 虚拟机安装RHEL 6.0 全图解
- 20100902 学习记录:GridView中的数据导出为Excel
- 20100901 学习记录:gridview的数据显示格式
- 记录:安装Aptana插件到eclipse的过程,学习javascript的第一步