setenv.sh在Tomcat中到底用于什么? [英] What exactly setenv.sh is used for in Tomcat?
问题描述
我进行了很多搜索,但找不到任何有用的信息:
I searched a lot but couldn't find any useful information about this:
确切是什么 setenv.sh 用于Tomcat吗?
假设我们有一个REST API(使用Java EE或Spring构建),其中使用了一些参数/变量,例如AWS Credentials,Database Credentials等。
Let's say we have a REST API (built with Java EE or Spring) which uses some parameters/variables like AWS Credentials, Database Credentials etc.
使用上面提到的这些环境变量对应用程序进行参数化并将它们的值放在<如果我们使用多个实例并使用不同的参数/变量,则为每个Tomcat实例使用em> setenv.sh ?
Does it make sense to parametrize the application with environment variables for these things I mentioned above and put their values to env vars on setenv.sh for each Tomcat instance in case we use more than one instance and with different parameters/variables ?
或 setenv.sh 不适合这样的事情吗?
Or setenv.sh isn't for things like that ?
预先感谢
推荐答案
我只见过它用于指定 CATALINA_OPTS
,但是我注意到 RUNNING.txt 文件提到了我们将其设置为 JRE_HOME
和 JAVA_HOME
。
I've only ever seen it used for specifying CATALINA_OPTS
, but I noticed that the RUNNING.txt file mentions using it to set JRE_HOME
and JAVA_HOME
.
<一个href = https://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt rel = nofollow noreferrer> RUNNING.txt 也在高级配置-多个Tomcat实例下声明:
在许多情况下,最好在
Tomcat二进制发行版之间共享一个副本同一台
服务器上的多个用户。为此,可以将CATALINA_BASE
环境变量设置为包含
个人 Tomcat实例文件的目录。
In many circumstances, it is desirable to have a single copy of a Tomcat binary distribution shared among multiple users on the same server. To make this possible, you can set the CATALINA_BASE environment variable to the directory that contains the files for your 'personal' Tomcat instance.
所以我想答案是可以为每个应用程序创建一个 setenv
文件,并且可能可以用来存储凭据,但是我不知道认为它通常用于此目的。
So I guess the answer is that a setenv
file can be created for each app and can probably can be used to store credentials, but I don't think that it's commonly used for that purpose.
这篇关于setenv.sh在Tomcat中到底用于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!