run elasticsearch and kibanawith docker bootstrap checks failed ERROR - docker

this is my first time using elasticsearch and I use this link but when I run this command
docker run --name es-node01 --net elastic -p 9200:9200 -p 9300:9300 -t docker.elastic.co/elasticsearch/elasticsearch:8.6.1
I got this error
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.

Try to disable swapping.
-e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_disable_swapping
EDIT:
To use it:
docker run --name es-node01 --net elastic -p 9200:9200 -p 9300:9300 -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 -t docker.elastic.co/elasticsearch/elasticsearch:8.6.1

Related

Elasticsearch production docker command not working at all, and when it works, it exits

I was following the tutorial for what should I do for when deploying elasticsearch for production, and I came up with these commands
docker run
-d
--name es01
-p 9200:9200
-p 9300:9300
--restart=unless-stopped
--ulimit nofile=65536:65536
-e "bootstrap.memory_lock=true"
--ulimit memlock=-1:-1
-e "discovery.type=single-node"
-e "cluster.name=es-cluster01"
-e "node.name=es01-node"
--mount source=elasticsearch,target=/usr/share/elasticsearch/data
elasticsearch:elasticsearch:8.6.1
-Xms4g -Xmx4g
This version of my docker command did not work, because of the -Xms4g -Xmx4g in the last part, it was unrecognized, I read in the production documentation that I should not use this command -e ES_JAVA_OPTS="-Xms1g -Xmx1g", but I am forced to use it in my second version since the alternative which is using -Xms4g -Xmx4g at the end of the command did not work, this is my 2nd attempt:
docker run
-d
--name es01
-p 9200:9200
-p 9300:9300
--restart=unless-stopped
--ulimit nofile=65536:65536
-e "bootstrap.memory_lock=true"
--ulimit memlock=-1:-1
-e "discovery.type=single-node"
-e "cluster.name=es-cluster01"
-e ES_JAVA_OPTS="-Xms1g -Xmx1g"
-e "node.name=es01-node"
--mount source=elasticsearch,target=/usr/share/elasticsearch/data
elasticsearch:elasticsearch:8.6.1
When I use this version, I get the following error which prevents elasticsearch installation from commencing:
"log.level":"ERROR", "message":"exception during geoip databases update",
So, in the end I came up with this version, where I removed -e ES_JAVA_OPTS="-Xms1g -Xmx1g" :
docker run
-d
--name es01
-p 9200:9200
-p 9300:9300
--restart=unless-stopped
--ulimit nofile=65536:65536
-e "bootstrap.memory_lock=true"
--ulimit memlock=-1:-1
-e "discovery.type=single-node"
-e "cluster.name=es-cluster01"
-e "node.name=es01-node"
--mount source=elasticsearch,target=/usr/share/elasticsearch/data
elasticsearch:elasticsearch:8.6.1
This version installs fine, without a problem, and I can see the default password and everything, and the docker container goes online, but the issue with this here is that, every 24 hours, it is unexpectedly exiting, without a log to show me what is wrong.
I used the command docker container inspect es01 and there is no error in STATUS.

How to set "xpack.security.enrollment.enabled" to "true for elasticsearch in Docker

This is how I start elasticsearch with Kibana in "Docker for Windows":
docker network create --driver bridge elastic
docker run -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 --name elasticsearch -v elasticsearch-data:/usr/share/elasticsearch/data -e "discovery.type=single-node" -e ELASTIC_USER=Andreas -e ELASTIC_PASSWORD=Hirsebrei docker.elastic.co/elasticsearch/elasticsearch:8.5.2
docker run --name kib-01 -p 5601:5601 docker.elastic.co/kibana/kibana:8.5.3
This all runs fine and I can open the Kibana pagein the browser which requests an enrollment token.
I use the following from a command line to generate the enrollment token:
docker exec -it elasticsearch /bin/sh
then in the shell I do this:
cd /usr/share/elasticsearch/bin/
./elasticsearch-create-enrollment-token --scope kibana
which results in the following error message:
ERROR: [xpack.security.enrollment.enabled] must be set to `true` to create an enrollment token
Now I am lost.
Can someone please help me out and explain to me how to set [xpack.security.enrollment.enabled] to true?

How to create multiple Debezium connectores for mysql database

I am tring to connect multiple Debezium connectores for a mysql database and my configurations are as follows.
sudo docker run -it --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 debezium/zookeeper:1.5 &
sudo docker run -it --name kafka -p 9092:9092 --link zookeeper:zookeeper debezium/kafka:1.5 &
sudo docker run -it --name connect -p 8083:8083 -e GROUP_ID=1 -e CONFIG_STORAGE_TOPIC=my_connect_configs -e OFFSET_STORAGE_TOPIC=my_connect_offsets -e STATUS_STORAGE_TOPIC=my_connect_statuses --link zookeeper:zookeeper --link kafka:kafka debezium/connect:1.5 &
sudo docker run -it --name connect1 -p 8084:8084 -e GROUP_ID=1 -e CONFIG_STORAGE_TOPIC=my_connect_configs -e OFFSET_STORAGE_TOPIC=my_connect_offsets -e STATUS_STORAGE_TOPIC=my_connect_statuses --link zookeeper:zookeeper --link kafka:kafka debezium/connect:1.5 &
but when i tring to run second connector...following error occurred.
ERRO[0000] error waiting for container: context canceled
Can anyone help me with this please.
You're not running any connectors, only containers for workers.
One Kafka Connect worker can be used to submit more than one connector task via the HTTP server on port 8083
Regarding the commands shown, you do not need multiple containers unless you are trying to create a Connect worker cluster
In order to do so, they need the same topics and the same group id.
You'd also want -p 8084:8083 since you've not changed the server port. Also, rather than using &, you can do docker run -d, but using Docker Compose would make more sense here

How to connect my Kibana to ElasticSearch in the docker run command?

Just trying to learn to setup Kibana and Elastic search using native docker command (i.e. not using Docker-Compose).
Below are the commands I run
docker network create es-net
docker run -d --name es-cluster \
--net es-net -p 9200:9200 \
-e "xpack.security.enabled=false" \
-e "discovery.type=single-node" \
docker.elastic.co/elasticsearch/elasticsearch:7.2.0
docker run -d --net es-net -p 5601:5601 \
-e ELASTICSEARCH_URL=http://es-cluster:9200 \
docker.elastic.co/kibana/kibana:7.2.0
Somehow Kibana is not loading the elastic search up when I run http://localhost:5601/ and always with the message Kibana server is not ready yet
I follow the answer as per Kibana on Docker cannot connect to Elasticsearch, to ensure the ELASTICSEARCH_URL is correctly set, but it is still not coming up. Anything I miss?
note: tested with curl 0.0.0.0:9200, the elastic search is already running
Looks like since I'm in version 7.2.0 of Kibana, it has changed from ELASTICSEARCH_URL to ELASTICSEARCH_HOSTS
as per https://www.elastic.co/guide/en/kibana/current/docker.html
docker run -d --net es-net -p 5601:5601 \
-e ELASTICSEARCH_HOSTS=http://es-cluster:9200 \
docker.elastic.co/kibana/kibana:7.2.0
With this in place, all should work then.

ElasticSearch with Docker - Enable Anonymous Access

For local development, I want to run an ElasticSearch (5.5.2) container using Docker, but I don't want to have to deal with authentication.
I have read https://www.elastic.co/guide/en/x-pack/5.5/anonymous-access.html, and it seems that the container comes with X-Pack which adds security (requiring a username and password).
Previously I have been running:
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name es docker.elastic.co/elasticsearch/elasticsearch:5.5.
How can I allow anonymous access?
Add the environmental variable xpack.security.enabled=false to the docker run command.
Complete command:
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "xpack.security.enabled=false" --name es docker.elastic.co/elasticsearch/elasticsearch:5.5.2
Reference: https://discuss.elastic.co/t/how-do-i-disable-x-pack-security-on-the-elasticsearch-5-2-2-docker-image/78183/4

Resources