[lxc-users] Elasticsearch 5.0 <-> LXD

Fajar A. Nugraha list at fajar.net
Mon Jan 9 12:44:23 UTC 2017


On Mon, Jan 9, 2017 at 8:08 AM, Fajar A. Nugraha <list at fajar.net> wrote:

> On Wed, Dec 28, 2016 at 10:51 PM, James Beedy <jamesbeedy at gmail.com>
> wrote:
>
>> I've stumbled onto what I think is a blocker for having Elasticsearch 5.0
>> run in a LXD container. I can install Elasticsearch 5.0
>>
>
Any insight on how I might get around this would be greatly appreciated.
>>
>>
>

> some generic things to try:- make sure it works on a real server or normal
> VM first (e.g. KVM). To eliminate any obvious configuration issue
> - try testing on privileged containers first. Possibly by using a VM to
> install lxd without using juju
> - if privileged containers work, then try unpriv containers
>
> Some apps (e.g. fuse) simply won't work on unpriv containers. Others (e.g.
> openvpn) needs modification to their systemd unit to work in unpriv
> containers. In any case, elasticsearch logs should provide more info.
>
>
FWIW, this works with elasticsearch 5.1:
- on HOST (since containers can't change this setting), run "sysctl -w
vm.max_map_count=262144" (and create the appropriate file in
/etc/sysctl.d/, if you wish)
- create a container (default unpriv xenial containers work fine), install
openjdk-8-jdk-headless in container
- on container: add elasticsearch repository, then "apt install
elasticsearch". It will fail. That's fine for now.
- add "ES_SKIP_SET_KERNEL_PARAMETERS=true" to /etc/default/elasticsearch
- add "network.host=10.0.3.154" (whatever your NIC ip is, obviously) to
/etc/elasticsearch/elasticsearch.yml
- apt install -f
- systemctl start elasticsearch

it should then work

# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled;
vendor preset: enabled)
   Active: active (running) since Mon 2017-01-09 12:35:54 UTC; 7min ago
     Docs: http://www.elastic.co
  Process: 7131
ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec
(code=exited, status=0/SUCCESS)
 Main PID: 7132 (java)
   CGroup: /system.slice/elasticsearch.service
           └─7132 /usr/bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly
-XX:+DisableE

Jan 09 12:35:54 xenial systemd[1]: Starting Elasticsearch...
Jan 09 12:35:54 xenial systemd[1]: Started Elasticsearch.

# wget -o /dev/null -O - 10.0.3.154:9200
{
  "name" : "dhRwHWx",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "15Lx5c7KQdmcUp_EsTqgQA",
  "version" : {
    "number" : "5.1.1",
    "build_hash" : "5395e21",
    "build_date" : "2016-12-06T12:36:15.409Z",
    "build_snapshot" : false,
    "lucene_version" : "6.3.0"
  },
  "tagline" : "You Know, for Search"
}

-- 
Fajar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170109/06ac6f43/attachment.html>


More information about the lxc-users mailing list