安裝JDKphp
sudo yum install java-1.8.0-openjdk.x86_64
測試html
[vagrant@localhost vagrant_data]$ java -version openjdk version "1.8.0_161" OpenJDK Runtime Environment (build 1.8.0_161-b14) OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
執行如下命令java
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.8.tar.gz tar -xvf elasticsearch-5.6.8.tar.gz cd elasticsearch-5.6.8/bin ./elasticsearch
測試是否安裝成功mysql
[vagrant@localhost elasticsearch-5.6.8]$ curl 'http://localhost:9200/?pretty' { "name" : "Lx20sHw", "cluster_name" : "elasticsearch", "cluster_uuid" : "gnYSlRb9TUqpVnBscm1-GQ", "version" : { "number" : "5.6.8", "build_hash" : "688ecce", "build_date" : "2018-02-16T16:46:30.010Z", "build_snapshot" : false, "lucene_version" : "6.6.1" }, "tagline" : "You Know, for Search" }
Vagrant內存不足報錯sql
[vagrant@localhost elasticsearch-5.6.8]$ ./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 OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory. # An error report file with more information is saved as: # /vagrant_data/elasticsearch-5.6.8/hs_err_pid22178.log [vagrant@localhost elasticsearch-5.6.8]$ free -m total used free shared buff/cache available Mem: 488 101 88 3 297 340 Swap: 1535 1 1534
解決方法:docker
添加以下信息:shell
config.vm.provider "virtualbox" do |v| v.memory = 2048 v.cpus = 2 end
vagrant reload
ElasticSearch 啓動報錯bootstrap
ERROR: [2] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解決方法:vim
sudo vim /etc/security/limits.conf # 添加以下信息: # [當前用戶名] hard nofile 65536 # [當前用戶名] soft nofile 65536 # 保存退出 ******************************************************************* sysctl -w vm.max_map_count=655360 sysctl -a | grep "vm.max_map_count"
version: "3" services: php_pc: image: php:7.2-cli container_name: pcsoft_php ports : - "9000:9000" volumes: - ./phpcli:/var/www/html/ db_pc: image: mysql:5.7 container_name: pcsoft_db volumes: - ./dbdata:/var/lib/mysql/ ports: - "3306:3306" environment: MYSQL_USER: root MYSQL_PASSWORD: root MYSQL_ROOT_PASSWORD: root elasticsearch_soft: image: registry.cn-hangzhou.aliyuncs.com/amor/elastic:6.2.3 container_name: es_pc_soft environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - xpack.security.enabled=false - "ES_JAVA_OPTS=-Xms2g -Xmx2g" ulimits: memlock: soft: -1 hard: -1 volumes: - ./docker_es/esdata_soft:/usr/share/elasticsearch/data ports: - 9200:9200 elasticsearch_game: image: registry.cn-hangzhou.aliyuncs.com/amor/elastic:6.2.3 container_name: es_pc_game environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - xpack.security.enabled=false - "ES_JAVA_OPTS=-Xms2g -Xmx2g" - "discovery.zen.ping.unicast.hosts=es_pc_soft" ulimits: memlock: soft: -1 hard: -1 volumes: - ./docker_es/esdata_game:/usr/share/elasticsearch/data kibana: image: registry.cn-hangzhou.aliyuncs.com/amor/kibana:6.2.3 container_name: es_pc_kibana environment: SERVER_NAME: kibana.pc_amor.com ELASTICSEARCH_URL: http://elasticsearch_soft:9200 XPACK_SECURITY_ENABLED: "false"
vm.max_map_count 報錯app
grep vm.max_map_count /etc/sysctl.conf # 若是找不到,則在該文件中添加 vm.max_map_count=262144 而後執行 sysctl -p # 臨時改變輕執行 sysctl -w vm.max_map_count=262144
不能以root權限運行問題
請檢查Elasticsearch掛載的目錄是不是root用戶建立的
Kibana連接問題
直接經過docker-compose server name連接便可
kibana沒法登錄問題
# 添加如下選項: XPACK_SECURITY_ENABLED: "false"