【问题标题】:InfluxDB on Windows Subsystem for Linux "cannot allocate memory"Linux 的 Windows 子系统上的 InfluxDB“无法分配内存”
【发布时间】:2017-12-04 20:41:48
【问题描述】:

在运行 Ubuntu 16.04 的 Windows 子系统上,我根据 Influx documentation 安装了 InfluxDB 1.4.2。我无法将它作为服务或 systemctl 运行,可能是因为 WSL 不支持它(请参阅 GitHub 问题 9941579),所以这些都不起作用:

$ sudo service influxdb start
influxdb: unrecognized service
$ sudo systemctl start influxdb
Failed to connect to bus: No such file or directory

如果我运行$ sudo influxd,Influx 会启动,但随后会因消息而崩溃

run: open server: open tsdb store: cannot allocate memory

如何解决“无法分配内存”错误?

【问题讨论】:

  • 我卸载并删除了我的数据库 ($ sudo apt-get purge influxdb; sudo rm -rf /var/lib/influxdb),然后重新安装,现在它可以工作了,但我很想知道首先出了什么问题。
  • 这意味着数据库需要比可用内存更多的内存。 WSL 如何处理这是任何人的猜测。你最好在实际的 Linux 上运行,甚至是虚拟化的。

标签: influxdb windows-subsystem-for-linux


【解决方案1】:

在 Win10 2018 春季更新中,我运行了以下内容:

sudo apt install influxdb influxdb-client -y

安装正常。

根据文档...

... 使用以下方式启动服务:

sudo service influxdb start

开始很好:

让我们连接、检查并创建一个数据库:

如果我在这里做错任何事情来重现,请告诉我,否则,看起来这个问题已经解决了。

【讨论】:

  • 此方法适用于 Win11 和 WSL2 和 Debian GNU/Linux 9 (stretch)
【解决方案2】:

我在 WSL 中安装时遇到了这个问题,但安装了 systemd。安装influxdb 软件包时,它注册了一个systemd 单元,因此我无法使用init.d 启动它。我使用this guide 解决了这个问题。我搜索旧版本并找到了 this,而不是指向 init.sh 脚本的死链接。

让 InfluxDB 在 WSL 中工作的步骤(至少在安装 systemd 时):

  1. 使用sudo apt install influxdb安装influxdb
  2. this file 的内容复制到位置/etc/init.d/influxdb 的新文件中
  3. 您现在可以使用 sudo service influxdb start 启动 influxdb。

对我来说,它在启动时显示了一条错误消息,但它仍然可以正确启动。

【讨论】:

  • 我没有尝试手动启动它,但没有像问题中那样创建 init.d 单元。相反,它创建了一个符号链接,就像您在 systemd 中需要它一样。
  • 对我不起作用(它不会启动任何进程):-/ 你在运行 WSL2 吗?
  • 我想我正在运行 WSL2。由于此答案已有一年之久,并且步骤 2 中的链接指向特定版本,因此您可以尝试使用该文件的 the most recent version
猜你喜欢
  • 2011-05-14
  • 2018-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-12-14
  • 1970-01-01
相关资源
最近更新 更多