在学习过程中,我们有时身边没有可用的服务器,这时就需要借助自己的 Mac 来安装和学习 Easysearch。然而,Easysearch 官网并未提供 Mac 版本的安装教程,下面我将详细整理我在 Mac 上安装和使用 Easysearch 的折腾经历。
Easysearch
Easysearch 的运行依赖于 Java,程序启动时会自动从当前目录的 JDK 中查找 Java 环境。因此,即便环境变量中已经配置了 Java,程序也可能无法找到。针对这个问题,有两种解决办法:
下载 JDK 的二进制文件,将其重命名为 “jdk”,并放置在 Easysearch 的根目录下。
下载 Easysearch 的 bundle 包,该包会自带一个 JDK。下载链接为:https://release.infinilabs.com/Easysearch/stable/bundle/
安装步骤如下:首先执行初始化脚本,此脚本会设置 TLS 证书和集群密码。在执行脚本之前,log 目录为空。
bin/initialize.sh
@@@@@@@@@@@
@@@@@@@@@@@@
@@@@@@@@@@@@
@@@@@@@@@&@@@
#@@@@@@@@@@@@@
@@@ @@@@@@@@@@@@@
&@@@@@@@ &@@@@@@@@@@@@@
@&@@@@@@@&@ @@@&@@@@@@@&@
@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@& @@@@@@@@@@@@@
%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@&@@@@@@@@@@@@@@@
@@ ,@@@@@@@@@@@@@@@@@@@@@@@&
@@@@@. @@@@@&@@@@@@@@@@@@@@
@@@@@@@@@@ @@@@@@@@@@@@@@@#
@&@@@&@@@&@@@ &@&@@@&@@@&@
@@@@@@@@@@@@@. @@@@@@@*
@@@@@@@@@@@@@ %@@@
@@@@@@@@@@@@@
/@@@@@@@&@@@@@
@@@@@@@@@@@@@
@@@@@@@@@@@@@
@@@@@@@@@@@@ Welcome to INFINI Labs!
Now attempting the initializing...
RISK WARNING: The initialization script will overwrite certificates and passwords. If this is not the first run, please acknowledge the risks before proceeding. This is a dangerous operation. Do you want to proceed? [y/N]:y
NOTICE: Do you want to log credentials to /Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle/logs/initialize.log? Default is no logging. Press Enter to skip. [y/N]:y
Using bundled JDK at /Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle/jdk
Certificate request self-signature ok
subject=C = IN, ST = FI, L = NI, O = ORG, OU = UNIT, CN = infini.cloud
Certificate request self-signature ok
subject=C = IN, ST = FI, L = NI, O = ORG, OU = UNIT, CN = admin.infini.cloud
DNS:infini.cloud, DNS:*.infini.cloud
DNS:infini.cloud, DNS:*.infini.cloud
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ NOTICE: Please remember the bootstrap credential for further usage @
@ admin:db3e19a8c1c9f7755763 @
@ Usage: curl -ku admin:db3e19a8c1c9f7755763 https://localhost:9200 @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Your plugins directory is not empty. Please install the plugin manually.
Initialization successful! [Easysearch] is ready to use!
----------------------------------------------------------------
cd /Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle && bin/Easysearch
----------------------------------------------------------------
__ _ __ ____ __ _ __ __
/ // |/ // __// // |/ // /
/ // || // _/ / // || // /
/_//_/|_//_/ /_//_/|_//_/
©INFINI.LTD, All Rights Reserved.
这里打印了集群的密码和连接信息:
curl -ku admin:db3e19a8c1c9f7755763 https://localhost:9200
然后启动集群,默认监听在 9200 端口:
❰xu❙~/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle❱✔≻ bin/Easysearch (base) 13:50:14
[2025-02-11T13:50:28,686][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: /Users/xu/Library/Caches/JNA/temp/jna114104068097844929.tmp: dlopen(/Users/xu/Library/Caches/JNA/temp/jna114104068097844929.tmp, 0x0001): tried: '/Users/xu/Library/Caches/JNA/temp/jna114104068097844929.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/xu/Library/Caches/JNA/temp/jna114104068097844929.tmp' (no such file), '/Users/xu/Library/Caches/JNA/temp/jna114104068097844929.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e' or 'arm64'))
at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source) ~[?:?]
at jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source) ~[?:?]
at jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source) ~[?:?]
at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[?:?]
at java.lang.Runtime.load0(Unknown Source) ~[?:?]
at java.lang.System.load(Unknown Source) ~[?:?]
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018) ~[jna-5.5.0.jar:5.5.0 (b0)]
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988) ~[jna-5.5.0.jar:5.5.0 (b0)]
at com.sun.jna.Native.<clinit>(Native.java:195) ~[jna-5.5.0.jar:5.5.0 (b0)]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Unknown Source) ~[?:?]
at org.Easysearch.bootstrap.Natives.<clinit>(Natives.java:30) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:95) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Bootstrap.setup(Bootstrap.java:163) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Bootstrap.init(Bootstrap.java:378) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Easysearch.init(Easysearch.java:169) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Easysearch.execute(Easysearch.java:160) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:71) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[Easysearch-cli-1.10.1.jar:1.10.1]
at org.Easysearch.cli.Command.main(Command.java:75) ~[Easysearch-cli-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Easysearch.main(Easysearch.java:125) ~[Easysearch-1.10.1.jar:1.10.1]
at org.Easysearch.bootstrap.Easysearch.main(Easysearch.java:67) ~[Easysearch-1.10.1.jar:1.10.1]
[2025-02-11T13:50:28,689][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] cannot check if running as root because JNA is not available
[2025-02-11T13:50:28,689][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] cannot install system call filter because JNA is not available
[2025-02-11T13:50:28,689][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] cannot register console handler because JNA is not available
[2025-02-11T13:50:28,690][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] cannot getrlimit RLIMIT_NPROC because JNA is not available
[2025-02-11T13:50:28,690][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] cannot getrlimit RLIMIT_AS because JNA is not available
[2025-02-11T13:50:28,690][WARN ][o.e.b.Natives ] [xudeMacBook-Pro.local] cannot getrlimit RLIMIT_FSIZE because JNA is not available
[2025-02-11T13:50:28,757][INFO ][o.e.n.Node ] [xudeMacBook-Pro.local] version[1.10.1], pid[18338], build[default/tar/1505f74d355bb2bac84162077fe66e9a32fc1be2/2025-01-24T21:02:00.632579Z], OS[Mac OS X/15.3/aarch64], JVM[Azul Systems, Inc./OpenJDK 64-Bit Server VM/17.0.13/17.0.13+11-LTS]
[2025-02-11T13:50:28,757][INFO ][o.e.n.Node ] [xudeMacBook-Pro.local] JVM home [/Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle/jdk]
[2025-02-11T13:50:28,758][INFO ][o.e.n.Node ] [xudeMacBook-Pro.local] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:G1ReservePercent=25, -XX:InitiatingHeapOccupancyPercent=30, -Djava.io.tmpdir=/var/folders/ft/rfbtvz_n5l9dg007x5lsk7jw0000gn/T/Easysearch-134350959148498936, -Djava.security.manager=allow, -Djava.locale.providers=SPI,COMPAT, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Des.path.home=/Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle, -Des.path.conf=/Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle/config, -Des.distribution.flavor=oss, -Des.distribution.type=tar, -Des.bundled_jdk=false]
[2025-02-11T13:50:29,116][INFO ][c.i.s.s.t.SSLConfig ] [xudeMacBook-Pro.local] SSL dual mode is disabled
[2025-02-11T13:50:29,117][INFO ][c.i.s.SecurityPlugin ] [xudeMacBook-Pro.local] ES Config path is /Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle/config
[2025-02-11T13:50:29,184][INFO ][c.i.s.s.DefaultSecurityKeyStore] [xudeMacBook-Pro.local] JVM supports TLSv1.3
[2025-02-11T13:50:29,185][INFO ][c.i.s.s.DefaultSecurityKeyStore] [xudeMacBook-Pro.local] Config directory is /Users/xu/Desktop/es/Easysearch-1.10.1-1978-mac-arm64-bundle/config/, from there the key- and truststore files are resolved relatively
[2025-02-11T13:50:29,389][INFO ][c.i.s.s.DefaultSecurityKeyStore] [xudeMacBook-Pro.local] TLS Transport Client Provider : JDK
[2025-02-11T13:50:29,389][INFO ][c.i.s.s.DefaultSecurityKeyStore] [xudeMacBook-Pro.local] TLS Transport Server Provider : JDK
[2025-02-11T13:50:29,389][INFO ][c.i.s.s.DefaultSecurityKeyStore] [xudeMacBook-Pro.local] TLS HTTP Provider : JDK
[2025-02-11T13:50:29,389][INFO ][c.i.s.s.DefaultSecurityKeyStore] [xudeMacBook-Pro.local] Enabled TLS p