重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
系统centos6.7
网站建设哪家好,找创新互联公司!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了肇源免费建站欢迎大家使用!1,安装jdk-1.8.0
yum install java-1.8.0-openjdk
2,下载elasticsearch-2.4.3.tar.gz并安装
tar zxvf elasticsearch-2.4.3.tar.gz -C /opt vi /opt/elasticsearch-2.4.3/conf/elasticsearch.yml
添加配置
network.host: 0.0.0.0#server绑定本地服务器内外网ip http.cors.enabled: true http.cors.allow-origin: "*"
3,启动
报错
penJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:160)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complete error details.
[root@vultr elasticsearch]# su es bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2016-12-29 08:56:59,510][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.plugins' (/opt/elasticsearch/plugins)
Likely root cause: java.nio.file.AccessDeniedException: /opt/elasticsearch/plugins
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:337)
at org.elasticsearch.bootstrap.Security.addPath(Security.java:314)
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:246)
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:212)
at org.elasticsearch.bootstrap.Security.configure(Security.java:118)
at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:212)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complete error details.
原因:1,新版本不允许用root启动,2,软件目录没相应的权限
解决:
groupadd es useradd -g es es passwd es
重新启动:
su es -c /opt/elasticsearch-2.4.3/bin/elasticsearch -Xmx2g -Xms2g - Des.index.storage.type=memory –d > /dev/null 2>&1 &” #因为我用的是虚拟机,内存比较小,所以启动看实际情况 -Xmx2g 是大内存 -Xms2g 是最小内存 -d 是后台运行 #我的运行命令是 su es -c /opt/elasticsearch/bin/elasticsearch –d > /dev/null 2>&1 &
安装插件:elasticsearch-head(是集群前段显示页面)
切换到bin目录下 执行
./plugin install mobz/elasticsearch-head
页面展示:http://localhost/_plugin/head
测试:
curl http://localhost:9200 出现一个json 数据表明启动成功,如下
{
"status": 200,
"name": "Omen",
"version": {
"number": "1.1.1",
"build_hash": "f1585f096d3f3985e73456debdc1a0745f512bbc",
"build_timestamp": "2014-04-16T14:27:12Z",
"build_snapshot": false,
"lucene_version": "4.7"
},
"tagline": "You Know, for Search"
}
安装插件:elasticsearch-kopf
执行命令:
./plugin install lmenezes/elasticsearch-kopf
页面展示:http://localhost/_plugin/bigdesk/
4,安装kibana
tar zxvf kibana-4.6.3-linux-x86_64.tar.gz -C /opt
修改配置
因为和elasticsearch 在同一台服务器上,所以只需要修改elasticsearch的链接地址
elasticsearch_url: http://localhost:9200
启动
bin/kibana -p 5601 > /dev/null 2>&1 &
意思是以5601端口启动
然后以http://ip:5601访问就可以了
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。