This commit is contained in:
2023-04-16 21:38:32 +08:00
parent a0849e40ef
commit 0b6c876a0f
59 changed files with 1026 additions and 189 deletions

View File

@@ -46,14 +46,14 @@ function Usage {
function RestoreConf {
if [ -z "$(ls config/)" ]; then
Print Restore default config files and quit ...
Print Restoring default config files and quit ...
tar zxf config.tgz
exit
fi
}
function ModifyConf {
Print Modify $conf ...
Print Modifying $conf ...
local kv=
local conf='config/elasticsearch.yml'
while read kv; do
@@ -61,30 +61,30 @@ function ModifyConf {
sed -i "/^${kv%%=*}: /d" $conf
echo "${kv/=/: }" >> $conf
done <<< "$(env | grep '^_CONF_' | sed 's/_CONF_//')"
Print Remove path.data and path.log in $conf ...
Print Removing path.data and path.log in $conf ...
sed -i -e '/^path\.data/d' -e '/^path\.logs/d' $conf
}
function InstallPlugin {
for f in $(ls -d offline-plugins/*.zip 2>/dev/null); do
Print Install plugins from offline file: $f ...
Print Installing plugins from offline file: $f ...
./bin/elasticsearch-plugin install file://$f
mv $f $f.installed
done
}
function ChangeOwner {
Print Change file owner ...
chown -R es.es config/ data/ logs/ plugins/
Print Changing file owner ...
chown -R es:es config/ data/ logs/ plugins/
}
function ChangeSysConf {
Print Change system conf ...
Print Changing system conf ...
echo 262144 > /proc/sys/vm/max_map_count || Print Not specified "--privileged".
}
function StartProc {
Print Start elasticsearch ...
Print Starting elasticsearch ...
su - es -c "
export JAVA_HOME=$JAVA_HOME
export PATH=$PATH
@@ -92,6 +92,7 @@ function StartProc {
/opt/es/bin/elasticsearch -Epath.data=/opt/es/data -Epath.logs=/opt/es/logs
" &> /dev/null &
PIDS="$PIDS $!"
Print Elasticsearch started.
}
function Main {