gpt4 book ai didi

ubuntu - 使用 elasticsearch 安装 Magento2 的问题

转载 作者:行者123 更新时间:2023-12-04 19:26:14 25 4
gpt4 key购买 nike

我正在关注在 Ubuntu 21.04 VPS 上安装 Magento2 的 tutorial
但是,当我执行 setup:install 步骤时(请参阅下面的代码),我收到一条错误消息,指出无法为 Elasticsearch 找到事件节点。

php bin/magento setup:install --base-url=<your-domain> --db-host=localhost --db-name=magento2 --db-user=magento2 --db-password=<your-db-password-of-magento2-user> --admin-firstname=Admin --admin-lastname=Admin --admin-email=admin@admin.com --admin-user=admin --admin-password=<your-admin-password> --language=en_US --currency=USD --timezone=America/Chicago --backend-frontname=admin --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200
在开始该过程之前,Elasticsearch 正在正确运行(请参阅下面的 systemctl start elasticsearch.service 输出)

elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled;vendor preset: enabled)
Active: active (running) since Tue 2022-01-11 00:36:48 UTC; 13s ago
Docs:
Main PID: 625 (java)
Tasks: 54 (limit: 2251)
Memory: 1.2G
CGroup: /system.slice/elasticsearch.service
|- 625 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto-Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encod> `-1225 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller


但是在运行上述命令后,得到错误并再次检查 elasticsearch 的状态,我得到以下信息:

elasticsearch.service - Elasticsearch
Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled;vendor preset: enabled)
Active: failed (Result: signal) since Tue 2022-01-11 00:39:44 UTC; 36sago
Docs:
Process: 625 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint-p ${PID_DIR}/elasticsearch.pid --quiet (code=killed, signal=KILL) Main PID: 625 (code=killed, signal=KILL)
Jan 11 00:35:39 server1..dmaker..mx systemd1: StartingElasticsearch...
Jan 11 00:36:48 server1..dmaker..mx systemd1: Started Elasticsearch.
Jan 11 00:39:44 server1..dmaker..mx systemd1: elasticsearch.service:Main process exited, code=killed, status=9/KILL
Jan 11 00:39:44 server1..dmaker..mx systemd1: elasticsearch.service:Failed with result 'signal'.
Jan 11 00:39:44 server1..dmaker..mx systemd1: elasticsearch.service:Unit process 1225 (controller) remains running after unit stopped.


尝试使用 systemctl start elasticsearch.service 再次启动服务会得到以下输出:

Job for elasticsearch.service failed because a fatal signal wasdelivered to the control process.
See "systemctl status elasticsearch.service" and "journalctl -xe" fordetails.

journalctl -xe 给出以下输出:

Jan 11 00:57:21 server1-dmaker-mx kernel: [ 975] 121 975
116649 334 131072 0 0 gsd-sharing
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1003] 121 1003
85475 486 147456 0 0 gsd-printer
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1037] 118 1037
61388 763 102400 0 0 colord
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1088] 0 1088
3757 373 65536 0 0 sshd
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1091] 121 1091
78788 1139 110592 0 0 ibus-daemon
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1096] 121 1096
59417 125 90112 0 0 ibus-dconf
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1099] 121 1099
225000 2525 405504 0 0 ibus-x11
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1105] 121 1105
59380 132 86016 0 0 ibus-portal
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1162] 121 1162
40960 127 77824 0 0 ibus-engine-sim
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1174] 0 1174
3370 245 61440 0 0 login
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1199] 0 1199
3844 366 69632 0 0 systemd
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1200] 0 1200
25543 838 94208 0 0 (sd-pam)
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1206] 0 1206
2826 358 53248 0 0 bash
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1250] 0 1250
2824 377 57344 0 0 bash
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1612] 0 1612
3756 371 69632 0 0 sshd
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1634] 0 1634
2824 374 57344 0 0 bash
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1642] 0 1642
3601 215 57344 0 0 sudo
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1643] 0 1643
3302 70 61440 0 0 systemctl
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1644] 0 1644
3279 146 61440 0 0 systemd-tty-ask
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1645] 123 1645
908357 296416 2744320 0 0 java
Jan 11 00:57:21 server1-dmaker-mx kernel: [ 1835] 123 1835
22973 144 81920 0 0 controller
Jan 11 00:57:21 server1-dmaker-mx kernel:oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/elasticsearch.service,task=java,pid=1645,uid=123Jan 11 00:57:21 server1-dmaker-mx kernel: Out of memory: Killedprocess 1645 (java) total-vm:3633428kB, anon-rss:1185664kB,file-rss:0kB, shmem-rss:0kB, UID:123 pgtables:2680kB oom_score_adj:0
Jan 11 00:57:21 server1-dmaker-mx kernel: oom_reaper: reaped process1645 (java), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Jan 11 00:57:21 server1-dmaker-mx systemd1: elasticsearch.service:Main process exited, code=killed, status=9/KILL
-- Subject: Unit process exited -- Defined-By: systemd -- Support: -- -- An ExecStart= process belonging to unit elasticsearch.service has exited.
-- -- The process' exit code is 'killed' and its exit status is 9. Jan 11 00:57:21 server1-dmaker-mx systemd1: elasticsearch.service:Failed with result 'signal'.
-- Subject: Unit failed -- Defined-By: systemd -- Support: -- -- The unit elasticsearch.service has entered the 'failed' state with result 'signal'.
Jan 11 00:57:21 server1-dmaker-mx sudo[1642]: pam_unix(sudo:session):session closed for user root
Jan 11 00:57:21 server1-dmaker-mx systemd-entrypoint[1835]: 2022-01-1100:57:21,546838 UTC [1835] INFO Main.cc@111 Parent process died - MLcontroller exiting
Jan 11 00:57:21 server1-dmaker-mx systemd1: elasticsearch.service:Unit process 1835 (controller) remains running after unit stopped.
Jan 11 00:57:21 server1-dmaker-mx systemd1: Failed to startElasticsearch.
-- Subject: A start job for unit elasticsearch.service has failed -- Defined-By: systemd -- Support: -- -- A start job for unit elasticsearch.service has finished with a failure.
-- -- The job identifier is 1329 and the job result is failed.


根据我的调查,这可能与我的 VPS 的内存有关。由于内存不足,elasticsearch 进程被终止。但在考虑升级我的服务器之前,我需要完全确定,因为我的提供商会向我收取新升级计划的月费。
我的 VPS 有 2GB 的 RAM 和 2 个 CPU 内核。

最佳答案

这是我解决的方法
首先,使用以下命令在您的 nano 编辑器中打开/etc/elasticsearch/elasticsearch.yml:

sudo nano /etc/elasticsearch/elasticsearch.yml


您的网络设置应为:
  • 将绑定(bind)地址设置为特定 IP(IPv4 或 IPv6):network.host: 127.0.0.1
  • 为 HTTP 设置自定义端口:http.port: 9200

  • 为了让 Elasticsearch 允许来自 localhost 的连接,并且还监听端口 9200。
    接下来,运行下面的代码来确定错误的原因:
    journalctl -xe
    您可以在此处查看详细答案: https://stackoverflow.com/a/58656748

    关于ubuntu - 使用 elasticsearch 安装 Magento2 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70669290/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com