虚拟机CentOS安装elasticsearch-6.3.1遇到的坑

在虚拟机下安装elasticsearch-6.3.1,发现如下错误:

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(0x00000006c5330000, 4207738880, 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 4207738880 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid3238.log

于是打开hs_err_pid3238.log发现如下:

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 4207738880 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2657), pid=3238, tid=0x00007fd8c7a1f700
#
# JRE version:  (8.0_171-b10) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.171-b10 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

---------------  T H R E A D  ---------------

Current thread (0x00007fd8c000c000):  JavaThread "Unknown thread" [_thread_in_vm, id=3276, stack(0x00007fd8c791f000,0x00007fd8c7a20000)]

Stack: [0x00007fd8c791f000,0x00007fd8c7a20000],  sp=0x00007fd8c7a1e310,  free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xa3fe6d]
V  [libjvm.so+0x4dcb99]
V  [libjvm.so+0x8afd73]
V  [libjvm.so+0x8aff99]
V  [libjvm.so+0x8a71ea]
V  [libjvm.so+0xa3c918]
V  [libjvm.so+0x5c9d89]
V  [libjvm.so+0x4c102e]
V  [libjvm.so+0x5caa99]
V  [libjvm.so+0x5ba026]
V  [libjvm.so+0xa0a921]
V  [libjvm.so+0xa0b9d3]
V  [libjvm.so+0x608915]
V  [libjvm.so+0x9efce7]
V  [libjvm.so+0x66e161]  JNI_CreateJavaVM+0x71
C  [libjli.so+0x3557]
C  [libpthread.so.0+0x7aa1]  start_thread+0xd1


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )

Other Threads:

=>0x00007fd8c000c000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=3276, stack(0x00007fd8c791f000,0x00007fd8c7a20000)]

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread: None

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Classes redefined (0 events):
No events

Internal exceptions (0 events):
No events

Events (0 events):
No events


Dynamic libraries:
00400000-00401000 r-xp 00000000 fd:00 528960                             /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/bin/java
00600000-00601000 rw-p 00000000 fd:00 528960                             /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/bin/java
00cf7000-00d18000 rw-p 00000000 00:00 0                                  [heap]
6c0000000-6c5330000 rw-p 00000000 00:00 0 
7fd8ac000000-7fd8ac021000 rw-p 00000000 00:00 0 
7fd8ac021000-7fd8b0000000 ---p 00000000 00:00 0 
7fd8b07ff000-7fd8b0829000 rw-p 00000000 00:00 0 
7fd8b0829000-7fd8b0fff000 ---p 00000000 00:00 0 
7fd8b0fff000-7fd8b1000000 rw-p 00000000 00:00 0 
7fd8b1000000-7fd8b1270000 rwxp 00000000 00:00 0 
7fd8b1270000-7fd8c0000000 ---p 00000000 00:00 0 
7fd8c0000000-7fd8c0036000 rw-p 00000000 00:00 0 
7fd8c0036000-7fd8c4000000 ---p 00000000 00:00 0 
7fd8c453a000-7fd8c463b000 rw-p 00000000 00:00 0 
7fd8c463b000-7fd8c463c000 ---p 00000000 00:00 0 
7fd8c463c000-7fd8c4746000 rw-p 00000000 00:00 0 
7fd8c4746000-7fd8c4afc000 ---p 00000000 00:00 0 
7fd8c4afc000-7fd8c4b04000 r-xp 00000000 fd:00 529004                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libzip.so
7fd8c4b04000-7fd8c4d03000 ---p 00008000 fd:00 529004                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libzip.so
7fd8c4d03000-7fd8c4d04000 rw-p 00007000 fd:00 529004                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libzip.so
7fd8c4d04000-7fd8c4d11000 r-xp 00000000 fd:00 130849                     /lib64/libnss_files-2.12.so
7fd8c4d11000-7fd8c4f10000 ---p 0000d000 fd:00 130849                     /lib64/libnss_files-2.12.so
7fd8c4f10000-7fd8c4f11000 r--p 0000c000 fd:00 130849                     /lib64/libnss_files-2.12.so
7fd8c4f11000-7fd8c4f12000 rw-p 0000d000 fd:00 130849                     /lib64/libnss_files-2.12.so
7fd8c4f12000-7fd8c4f3d000 r-xp 00000000 fd:00 528986                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libjava.so
7fd8c4f3d000-7fd8c513c000 ---p 0002b000 fd:00 528986                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libjava.so
7fd8c513c000-7fd8c513e000 rw-p 0002a000 fd:00 528986                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libjava.so
7fd8c513e000-7fd8c514c000 r-xp 00000000 fd:00 529003                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libverify.so
7fd8c514c000-7fd8c534b000 ---p 0000e000 fd:00 529003                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libverify.so
7fd8c534b000-7fd8c534d000 rw-p 0000d000 fd:00 529003                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/libverify.so
7fd8c534d000-7fd8c5354000 r-xp 00000000 fd:00 130861                     /lib64/librt-2.12.so
7fd8c5354000-7fd8c5553000 ---p 00007000 fd:00 130861                     /lib64/librt-2.12.so
7fd8c5553000-7fd8c5554000 r--p 00006000 fd:00 130861                     /lib64/librt-2.12.so
7fd8c5554000-7fd8c5555000 rw-p 00007000 fd:00 130861                     /lib64/librt-2.12.so
7fd8c5555000-7fd8c556b000 r-xp 00000000 fd:00 130819                     /lib64/libgcc_s-4.4.7-20120601.so.1
7fd8c556b000-7fd8c576a000 ---p 00016000 fd:00 130819                     /lib64/libgcc_s-4.4.7-20120601.so.1
7fd8c576a000-7fd8c576b000 rw-p 00015000 fd:00 130819                     /lib64/libgcc_s-4.4.7-20120601.so.1
7fd8c576b000-7fd8c57ee000 r-xp 00000000 fd:00 130841                     /lib64/libm-2.12.so
7fd8c57ee000-7fd8c59ed000 ---p 00083000 fd:00 130841                     /lib64/libm-2.12.so
7fd8c59ed000-7fd8c59ee000 r--p 00082000 fd:00 130841                     /lib64/libm-2.12.so
7fd8c59ee000-7fd8c59ef000 rw-p 00083000 fd:00 130841                     /lib64/libm-2.12.so
7fd8c59ef000-7fd8c5ad7000 r-xp 00000000 fd:00 263812                     /usr/lib64/libstdc++.so.6.0.13
7fd8c5ad7000-7fd8c5cd7000 ---p 000e8000 fd:00 263812                     /usr/lib64/libstdc++.so.6.0.13
7fd8c5cd7000-7fd8c5cde000 r--p 000e8000 fd:00 263812                     /usr/lib64/libstdc++.so.6.0.13
7fd8c5cde000-7fd8c5ce0000 rw-p 000ef000 fd:00 263812                     /usr/lib64/libstdc++.so.6.0.13
7fd8c5ce0000-7fd8c5cf5000 rw-p 00000000 00:00 0 
7fd8c5cf5000-7fd8c6933000 r-xp 00000000 fd:00 529008                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
7fd8c6933000-7fd8c6b33000 ---p 00c3e000 fd:00 529008                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
7fd8c6b33000-7fd8c6c02000 rw-p 00c3e000 fd:00 529008                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/server/libjvm.so
7fd8c6c02000-7fd8c6c32000 rw-p 00000000 00:00 0 
7fd8c6c32000-7fd8c6dbc000 r-xp 00000000 fd:00 130833                     /lib64/libc-2.12.so
7fd8c6dbc000-7fd8c6fbc000 ---p 0018a000 fd:00 130833                     /lib64/libc-2.12.so
7fd8c6fbc000-7fd8c6fc0000 r--p 0018a000 fd:00 130833                     /lib64/libc-2.12.so
7fd8c6fc0000-7fd8c6fc2000 rw-p 0018e000 fd:00 130833                     /lib64/libc-2.12.so
7fd8c6fc2000-7fd8c6fc6000 rw-p 00000000 00:00 0 
7fd8c6fc6000-7fd8c6fc8000 r-xp 00000000 fd:00 130839                     /lib64/libdl-2.12.so
7fd8c6fc8000-7fd8c71c8000 ---p 00002000 fd:00 130839                     /lib64/libdl-2.12.so
7fd8c71c8000-7fd8c71c9000 r--p 00002000 fd:00 130839                     /lib64/libdl-2.12.so
7fd8c71c9000-7fd8c71ca000 rw-p 00003000 fd:00 130839                     /lib64/libdl-2.12.so
7fd8c71ca000-7fd8c71d8000 r-xp 00000000 fd:00 528973                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/jli/libjli.so
7fd8c71d8000-7fd8c73d7000 ---p 0000e000 fd:00 528973                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/jli/libjli.so
7fd8c73d7000-7fd8c73d8000 rw-p 0000d000 fd:00 528973                     /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre/lib/amd64/jli/libjli.so
7fd8c73d8000-7fd8c73ed000 r-xp 00000000 fd:00 130884                     /lib64/libz.so.1.2.3
7fd8c73ed000-7fd8c75ec000 ---p 00015000 fd:00 130884                     /lib64/libz.so.1.2.3
7fd8c75ec000-7fd8c75ed000 r--p 00014000 fd:00 130884                     /lib64/libz.so.1.2.3
7fd8c75ed000-7fd8c75ee000 rw-p 00015000 fd:00 130884                     /lib64/libz.so.1.2.3
7fd8c75ee000-7fd8c7605000 r-xp 00000000 fd:00 130857                     /lib64/libpthread-2.12.so
7fd8c7605000-7fd8c7805000 ---p 00017000 fd:00 130857                     /lib64/libpthread-2.12.so
7fd8c7805000-7fd8c7806000 r--p 00017000 fd:00 130857                     /lib64/libpthread-2.12.so
7fd8c7806000-7fd8c7807000 rw-p 00018000 fd:00 130857                     /lib64/libpthread-2.12.so
7fd8c7807000-7fd8c780b000 rw-p 00000000 00:00 0 
7fd8c780b000-7fd8c782b000 r-xp 00000000 fd:00 131227                     /lib64/ld-2.12.so
7fd8c7916000-7fd8c7917000 rw-p 00000000 00:00 0 
7fd8c7917000-7fd8c791f000 rw-s 00000000 fd:00 397200                     /tmp/hsperfdata_root/3238
7fd8c791f000-7fd8c7922000 ---p 00000000 00:00 0 
7fd8c7922000-7fd8c7a26000 rw-p 00000000 00:00 0 
7fd8c7a26000-7fd8c7a29000 rw-p 00000000 00:00 0 
7fd8c7a29000-7fd8c7a2a000 r--p 00000000 00:00 0 
7fd8c7a2a000-7fd8c7a2b000 rw-p 00000000 00:00 0 
7fd8c7a2b000-7fd8c7a2c000 r--p 00020000 fd:00 131227                     /lib64/ld-2.12.so
7fd8c7a2c000-7fd8c7a2d000 rw-p 00021000 fd:00 131227                     /lib64/ld-2.12.so
7fd8c7a2d000-7fd8c7a2e000 rw-p 00000000 00:00 0 
7fff53afa000-7fff53b0f000 rw-p 00000000 00:00 0                          [stack]
7fff53bad000-7fff53bae000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

VM Arguments:
jvm_args: -Xms4g -Xmx4g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.JaKkau3o -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/usr/local/elasticsearch/elasticsearch-6.3.1 -Des.path.conf=/usr/local/elasticsearch/elasticsearch-6.3.1/config -Des.distribution.flavor=default -Des.distribution.type=tar 
java_command: org.elasticsearch.bootstrap.Elasticsearch
java_class_path (initial): /usr/local/elasticsearch/elasticsearch-6.3.1/lib/t-digest-3.2.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/plugin-classloader-6.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/jna-4.5.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/spatial4j-0.7.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/log4j-core-2.9.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/jackson-core-2.8.10.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-suggest-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/hppc-0.7.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-analyzers-common-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-spatial-extras-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/HdrHistogram-2.1.9.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/elasticsearch-launchers-6.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-spatial-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-grouping-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/jackson-dataformat-smile-2.8.10.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/elasticsearch-6.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/elasticsearch-secure-sm-6.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/snakeyaml-1.17.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-core-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/plugin-cli-6.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-backward-codecs-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/jackson-dataformat-cbor-2.8.10.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-join-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/lucene-misc-7.3.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/log4j-1.2-api-2.9.1.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/lib/jopt-simple-5.0.2.jar:/usr/local/elasticsearch/elasticsearch-6.3.1/l
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/maven/apache-maven-3.5.4/bin:/root/bin
SHELL=/bin/bash

Signal Handlers:
SIGSEGV: [libjvm.so+0xa40890], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGBUS: [libjvm.so+0xa40890], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGFPE: [libjvm.so+0x8a9880], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGPIPE: [libjvm.so+0x8a9880], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGXFSZ: [libjvm.so+0x8a9880], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGILL: [libjvm.so+0x8a9880], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGUSR1: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none
SIGUSR2: [libjvm.so+0x8ab020], sa_mask[0]=00000000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO
SIGHUP: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none
SIGINT: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none
SIGTERM: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none
SIGQUIT: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none


---------------  S Y S T E M  ---------------

OS:CentOS release 6.8 (Final)

uname:Linux 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01 UTC 2016 x86_64
libc:glibc 2.12 NPTL 2.12 
rlimit: STACK 10240k, CORE 0k, NPROC 3838, NOFILE 4096, AS infinity
load average:0.08 0.09 0.07

/proc/meminfo:
MemTotal:        1004136 kB
MemFree:          744752 kB
Buffers:            3776 kB
Cached:            42408 kB
SwapCached:         2632 kB
Active:           110724 kB
Inactive:          28068 kB
Active(anon):      89448 kB
Inactive(anon):     3220 kB
Active(file):      21276 kB
Inactive(file):    24848 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       2031612 kB
SwapFree:        2020748 kB
Dirty:               100 kB
Writeback:             0 kB
AnonPages:         84464 kB
Mapped:             6568 kB
Shmem:                 0 kB
Slab:              67872 kB
SReclaimable:       9256 kB
SUnreclaim:        58616 kB
KernelStack:        1344 kB
PageTables:         1660 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2533680 kB
Committed_AS:     153568 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      177148 kB
VmallocChunk:   34359544416 kB
HardwareCorrupted:     0 kB
AnonHugePages:     79872 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        6144 kB
DirectMap2M:     1042432 kB
DirectMap1G:           0 kB


CPU:total 1 (initial active 1) (1 cores per cpu, 1 threads per core) family 6 model 142 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, tsc, tscinvbit, bmi1, bmi2, adx

/proc/cpuinfo:
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 142
model name  : Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
stepping    : 9
microcode   : 132
cpu MHz     : 2303.881
cache size  : 4096 KB
physical id : 0
siblings    : 1
core id     : 0
cpu cores   : 1
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc up arch_perfmon xtopology tsc_reliable nonstop_tsc unfair_spinlock pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch arat xsaveopt fsgsbase bmi1 hle avx2 smep bmi2 invpcid rtm rdseed adx
bogomips    : 4607.76
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management:



Memory: 4k page, physical 1004136k(744752k free), swap 2031612k(2020748k free)

vm_info: OpenJDK 64-Bit Server VM (25.171-b10) for linux-amd64 JRE (1.8.0_171-b10), built on May 22 2018 00:51:27 by "mockbuild" with gcc 4.4.7 20120313 (Red Hat 4.4.7-18)

time: Fri Apr 27 04:06:56 2018
elapsed time: 0 seconds (0d 0h 0m 0s)

内存不足,将es的config目录下的jvm.options打开,将里面的

-Xms1g
-Xmx1g

改为

-Xms2g
-Xmx2g

再次启动,发现又有一个错误:

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.1.jar:6.3.1]
    ... 6 more

这个错误,是因为使用root用户启动elasticsearch,elasticsearch是不允许使用root用户启动的。
解决办法是创建一个新的用户来启动:

groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
chown -R elsearch:elsearch  elasticsearch
su elsearch

再次启动,发现了下面的错误:= =!

[2018-04-27T05:30:32,055][WARN ][o.e.b.JNANatives         ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
    at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:341) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:616) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:258) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:109) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) [elasticsearch-6.3.1.jar:6.3.1]

修改elasticsearch.yml,增加或替换下面两个配置:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

重新启动,可以,换个终端,使用curl -X GET http://localhost:9200,可以出现:

{
  "name" : "node-192.168.20.128:9200",
  "cluster_name" : "192.168.20.128",
  "cluster_uuid" : "7sHTHp5cQKGcB2l1p3Z_FQ",
  "version" : {
    "number" : "6.3.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "eb782d0",
    "build_date" : "2018-06-29T21:59:26.107521Z",
    "build_snapshot" : false,
    "lucene_version" : "7.3.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

猜你喜欢

转载自blog.csdn.net/a_842297171/article/details/80944412
今日推荐