Vyacheslav Tutrinov created HDDS-10898:
------------------------------------------

             Summary: Why the log4j.properties configuration file is mandatory?
                 Key: HDDS-10898
                 URL: https://issues.apache.org/jira/browse/HDDS-10898
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Vyacheslav Tutrinov


# Imagine a case:

1. I know what the Ozone is and I'm familiar with its basic environment 
variables (e.g. *OZONE_CONF_DIR*, *OZONE_OPTS*)
2. There is the *ozone-site.xml* (empty, so far) configuration file.
3. The conf file is deployed to a specific conf dir on my infrastructure's hosts
4. Ozone binaries are deployed too
5. Try to start an ozone's service instance (e.g. *scm*):

Cmd:
{code:bash}
export OZONE_CONF_DIR=/my/custom/path/to/ozone/configurations/files
${OZONE_HOME}/bin/ozone scm --init
${OZONE_HOME}/bin/ozone scm
{code}1

Output:
{code: bash}
# a lot of info about classpath + default conf properties
2024-05-22 07:30:26,012 [main] ERROR server.StorageContainerManagerStarter: SCM 
start failed with exception
java.lang.IllegalArgumentException: ozone.metadata.dirs must be defined.
        at 
org.apache.hadoop.hdds.server.ServerUtils.getOzoneMetaDirPath(ServerUtils.java:284)
        at 
org.apache.hadoop.hdds.server.ServerUtils.getScmDbDir(ServerUtils.java:158)
        at 
org.apache.hadoop.hdds.scm.server.SCMStorageConfig.<init>(SCMStorageConfig.java:49)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManager.<init>(StorageContainerManager.java:362)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManager.createSCM(StorageContainerManager.java:611)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManager.createSCM(StorageContainerManager.java:623)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter$SCMStarterHelper.start(StorageContainerManagerStarter.java:171)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.startScm(StorageContainerManagerStarter.java:145)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.call(StorageContainerManagerStarter.java:74)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.call(StorageContainerManagerStarter.java:48)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at 
picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at 
picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at org.apache.hadoop.hdds.cli.GenericCli.execute(GenericCli.java:100)
        at org.apache.hadoop.hdds.cli.GenericCli.run(GenericCli.java:91)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.main(StorageContainerManagerStarter.java:63)
ozone.metadata.dirs must be defined.
{code}

6. OK, Mr. Ozone, let me define the config property

{code:bash}
cat /my/custom/path/to/ozone/configurations/files/ozone-site.xml
<configuration>
        <property>
                <name>ozone.metadata.dirs</name>
                <value>/data/metadata</value>
        </property>
</configuration>
{code}

7. Another attempt to start the SCM:

Cmd:
{code:bash}
${OZONE_HOME}/bin/ozone scm
{code}

Output:
{code:bash}
# Hmm, the same output ...
2024-05-22 08:01:23,365 [main] ERROR server.StorageContainerManagerStarter: SCM 
start failed with exception
java.lang.IllegalArgumentException: ozone.metadata.dirs must be defined.
        at 
org.apache.hadoop.hdds.server.ServerUtils.getOzoneMetaDirPath(ServerUtils.java:284)
        at 
org.apache.hadoop.hdds.server.ServerUtils.getScmDbDir(ServerUtils.java:158)
        at 
org.apache.hadoop.hdds.scm.server.SCMStorageConfig.<init>(SCMStorageConfig.java:49)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManager.<init>(StorageContainerManager.java:362)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManager.createSCM(StorageContainerManager.java:611)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManager.createSCM(StorageContainerManager.java:623)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter$SCMStarterHelper.start(StorageContainerManagerStarter.java:171)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.startScm(StorageContainerManagerStarter.java:145)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.call(StorageContainerManagerStarter.java:74)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.call(StorageContainerManagerStarter.java:48)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at 
picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at 
picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at org.apache.hadoop.hdds.cli.GenericCli.execute(GenericCli.java:100)
        at org.apache.hadoop.hdds.cli.GenericCli.run(GenericCli.java:91)
        at 
org.apache.hadoop.hdds.scm.server.StorageContainerManagerStarter.main(StorageContainerManagerStarter.java:63)
ozone.metadata.dirs must be defined.
{code}

# What's going on?

Provided *OZONE_CONF_DIR* doesn't affect the ozone behavior, but why? Let's 
dive into bin/ozone shell script.

It has the following lines:

{code:bash}
ozone_bootstrap
. "${OZONE_LIBEXEC_DIR}/ozone-config.sh"
{code}

The ozone-config.sh has the following lines:

{code:bash}
#
# Setup the base-line environment
#
ozone_find_confdir
{code}

And the ozone-functions.sh related code is:

{code:bash}

{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to