centos 6.7, elasticsearch 5
I have installed the elasticsearch using rpm. But failed to start it.
error: permission denied on key 'vm.max_map_count'
Starting elasticsearch: /usr/share/elasticsearch/bin/elasticsearch: line 198: 875 Killed exec "$JAVA" $ES_JAVA_OPTS -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" org.elasticsearch.bootstrap.Elasticsearch "$#" 0>&-
[FAILED]
I think you should set vm.max_map_count to an appropriate value.
see https://www.elastic.co/guide/en/elasticsearch/reference/current/_maximum_map_count_check.html
and https://github.com/elastic/elasticsearch/issues/4978
Something like should solve your issue:
sudo sysctl -w vm.max_map_count=262144
e.g. edit (vi/vim) /etc/init.d/elastic_search (or however you spell it), and change,
CURRENT_MAX_MAP_COUNT=`sysctl vm.max_map_count | cut -d'=' -f2`;
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
if [ $MAX_MAP_COUNT -gt $CURRENT_MAX_MAP_COUNT ]; then
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
fi
fi
Related
I am a beginner to Docker and was trying to optimize the following bash shell code. The below code continuously has to create a docker container and remove it. What I would like is a one-time creation of the docker container; then based on the if-else condition, the corresponding command gets iteratively executed in while loop and finally, the docker container gets deleted. I have tried to play around with docker entrypoint commands but all of them seem to insist on a single line command with docker run. Some help will be deeply appreciated! Thanks!
#!/bin/bash
FILE=$1
flag=1
while read line; do
#echo $line
#echo $flag
if [ $flag -gt 0 ] && [ $flag -lt 23189 ]; then
docker run --rm -v $(pwd):/eric -w /eric --entrypoint /bin/sh fedora -c "dnf info $line | tee -a manifest-fed:Core.txt; dnf repoquery --srpm $line"
((++flag))
elif [ $flag -gt 23188 ] && [ $flag -lt 46379 ]; then
docker run --rm -v $(pwd):/eric -w /eric --entrypoint /bin/sh fedora -c "dnf info $line | tee -a manifest-fed:Old.txt; dnf info $line"
((++flag))
elif [ $flag -gt 46378 ] && [ $flag -lt 69571 ]; then
docker run --rm -v $(pwd):/eric -w /eric --entrypoint /bin/sh fedora -c "dnf info $line | tee -a manifest-fed:Graphics.txt"
((++flag))
fi
done<"$1"
Create container in detached mode:
docker run -d -t --rm --name my_container -v $(pwd):/eric -w /eric fedora
Run your commands in this container:
docker exec my_container sh -c "echo test"
You may wrap those commands in a single script and put it in your pwd mapped to '/eric' volume. And then execute them something like:
docker run --rm -v $(pwd):/eric -w /eric --entrypoint /bin/sh fedora -c "/eric/dnf-info.sh 1 '$line'"
Script dnf-info.sh may be:
#! /bin/sh
case $1 in
1)
dnf info "$2" | tee -a manifest-fed:Core.txt; dnf repoquery --srpm "$2"
;;
2)
dnf info "$2" | tee -a manifest-fed:Old.txt; dnf info "$2"
;;
3)
dnf info "$2" | tee -a manifest-fed:Graphics.txt
;;
esac
I'm setting a new condition for run delete job if exist but don't work in production case.
GNU bash, v4.3.48(1)-release (x86_64-pc-linux-gnu)
docker run -e GO_DEPENDENCY_LABEL_PIPE='XXXXX' -e CREDENTIAL_NAME='production.XXXXX' -e KUBE_TOKEN='XXXXX' -v /go/pipelines/deploy-portal-site-data/helm:/helm --add-host=api.production.XXXXX:00.000.000.000 --rm -t --entrypoint /bin/bash docker.XXXXX.com.br/kubectl-prod:latest --login -c "kubectl config set-credentials production.XXXXX --token=XXXXX; VerifyJob=0; [[ -ge 1 ]] && kubectl -n production delete job portal-site-data-production || echo 'There is no job at the moment'"
I expect the output of clean job, but the actual output is
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.
Not installing Tiller due to 'client-only' flag having been set
Happy Helming!
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈
"gfn-helm-repo" has been added to your repositories
/bin/bash: -c: line 0: conditional binary operator expected
/bin/bash: -c: line 0: syntax error near `1'
/bin/bash: -c: line 0: `kubectl config set-credentials production.XXXXX --token=XXXXX; VerifyJob=0; [[ -ge 1 ]] && kubectl -n production delete job portal-site-data-production || echo 'There is no job at the moment''
[[ -ge 1 ]]
I think the error comes from this part of the command.
It is testing if "undefined" is greater or equal to 1
I deleted my chart
helm delete portal-site-data-production --tiller-namespace production --purge
and put \ before the "
set -x
docker pull $DOCKER_HELM_PROD_IMAGE
docker run \
-e GO_DEPENDENCY_LABEL_PIPE='${GO_DEPENDENCY_LABEL_PIPE}' \
-e CREDENTIAL_NAME='${CREDENTIAL_NAME}' \
-e KUBE_TOKEN='${KUBE_TOKEN}' \
-v $PWD/helm:/helm \
--add-host=api.production.XXXXX:00.000.000.000 \
--rm -t --entrypoint /bin/bash \
$DOCKER_HELM_PROD_IMAGE \
--login -c "kubectl config set-credentials ${CREDENTIAL_NAME} --token=${KUBE_TOKEN}; VerifyJob=$(kubectl -n production get job| grep -c portal-site-data-production); \"[[ ${VerifyJob} -ge 1 ]]\" && kubectl -n production delete job portal-site-data-production || echo \"There is no job at the moment\""
This Ok now, thank you very much to everyone.
The Xenial (Ubuntu 16.04) image on Travis-CI comes with Elasticsearch-5.5 preinstalled. What should I put in my .travis.yml to run my builds against Elasticsearch-7.0?
Add these commands to your before_install step:
- curl -s -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-amd64.deb
- sudo dpkg -i --force-confnew elasticsearch-7.0.1-amd64.deb
- sudo sed -i.old 's/-Xms1g/-Xms128m/' /etc/elasticsearch/jvm.options
- sudo sed -i.old 's/-Xmx1g/-Xmx128m/' /etc/elasticsearch/jvm.options
- echo -e '-XX:+DisableExplicitGC\n-Djdk.io.permissionsUseCanonicalPath=true\n-Dlog4j.skipJansi=true\n-server\n' | sudo tee -a /etc/elasticsearch/jvm.options
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
- sudo systemctl start elasticsearch
The changes to jvm.options are done in an attempt to emulate the existing config for Elasticsearch-5.5, which I assume the Travis peeps have actually thought about.
According to the Travis docs, you should also add this line to your before_script step:
- sleep 10
This is to ensure Elasticsearch is up and running, but I haven't checked if it's actually necessary.
One small addition to #kthy answer that had me stumbling for a bit. You need to remove - elasticsearch from your services: definition in the .travis.yml otherwise no matter what you put in before_install, the default service will override it!
services:
- elasticsearch
Remove ^^ and then you can proceed with the steps he outlined and it should all work smoothly.
if you want to wait for the elastic search to start (which may be longer or shorter than 10 seconds) replace the sleep 10 with this:
host="localhost:9200"
response=""
attempt=0
until [ "$response" = "200" ]; do
if [ $attempt -ge 25 ]; then
echo "FAILED. Elasticsearch not responding after $attempt tries."
exit 1
fi
echo "Contacting Elasticsearch on ${host}. Try number ${attempt}"
response=$(curl --write-out %{http_code} --silent --output /dev/null "$host")
sleep 1
attempt=$[$attempt+1]
done
All
I am new to elasticsearch. and I have installed the elasticsearch 5.6 on Ubuntu 14.04, with apt-get following the instruction on this page.
However, it fail to start when I was trying this command
sudo -i service elasticsearch start
Then I add a log line to check what the command really is.
log_daemon_msg "sudo -u $ES_USER $DAEMON $DAEMON_OPTS"
start-stop-daemon -d $ES_HOME --start --user "$ES_USER" -c "$ES_USER" --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
It returns
sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch -d -p /var/run/elasticsearch/elasticsearch.pid -Edefault.path.logs=/var/log/elasticsearch -Edefault.path.data=/var/lib/elasticsearch -Edefault.path.conf=/etc/elasticsearch
I try to run is command directly, and the command exit without print any log. I also check the /var/log/elasticsearch, which is an empty dir.
Could anyone help to find out what do I miss?
Thanks.
BTW. I am running a 512M RAM, and 1G swap machine. and I have modifed the jvm.options to -Xms256m and -Xmx256m
I'm using Docker steps as below to bring up selenium grid
My query is how to gracefully wait till particular container is downloaded , up and running.
docker run -ti -m 150M --memory-swap 300M --cpu-shares=104 -d -p 4444:4444 --name selenium-hub -e GRID_BROWSER_TIMEOUT=15000 selenium/hub
sleep 10
for i in {1..2}
do
echo "Starting Node: $i"
docker run -ti -m 750M --memory-swap 900M --cpu-shares=460 -d --link selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome
sleep 5
done
Is there better way of avoiding sleep , as sometimes container download takes longer.
After the job is done , I stop and remove all the containers in order to do fresh start for new job.
Thanks & Regards,
Vikram
You can call the selenium service with curl and check the result:
Then in a while check for COUNT value if it is different from zero
COUNT=$(curl -q localhost:4444 | grep 403 | wc -l)
while [ $COUNT -eq 0 ]
do
sleep 1
COUNT=$(curl -q localhost:4444 | grep 403 | wc -l)
done
Regards