I have a environment variable MY_HOME
which has a path to a directory /home/abc
Now, I have a redis.conf
file In which I need to set this path like this
**redis.conf**
pidfile $MY_HOME/local/var/pids/redis.pid
logfile $MY_HOME/local/var/log/redis.log
dir $MY_HOME/local/var/lib/redis/
like we do in command line, so that my config file picks the path based on the Environment variable.
The Redis configuration file is located at installdir/redis/etc/redis. conf.
Configsets are a set of configuration files used in a Solr installation: solrconfig. xml , the schema, and then resources like language files, synonyms. txt , DIH-related configuration, and others that are referenced from the config or schema.
folder: C:\Program Files\Redis\conf - there is some template conf file.
Because Redis can read its config from stdin
, I do something very similar to what @jolestar suggested. I put placeholder variables in my redis.conf
and then replace them using sed
in my Redis launcher. For example:
==========
$MY_HOME/redis/redis.conf
==========
...
pidfile {DIR}/pids/server{n}.pid
port 123{n}
...
Then I have a script to start Redis:
==========
runredis.sh
==========
DIR=$MY_HOME/redis
for n in {1..4}; do
echo "starting redis-server #$n ..."
sed -e "s/{n}/$n/g" -e "s/{DIR}/$DIR/g" < $DIR/redis.conf | redis-server -
done
I've been using this approach forever and it works out well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With