Cannot change MB_JETTY_PORT Port Number

I am trying to install Metabase for the first time on a Windows Server 2016 Standard box. I am getting the error below. I tried changing the port number through the PowerShell but that did not work.

PS K:> cd C:/Metabase
PS C:\Metabase> java -jar metabase.jar
04-02 10:31:04 DEBUG plugins.classloader :: Using NEWLY CREATED classloader as shared context classloader: clojure.lang.DynamicClassLoader@39ce27f2
04-02 10:31:04 INFO metabase.util :: Loading Metabase…
04-02 10:31:04 INFO metabase.util :: Maximum memory available to JVM: 14.1 GB
04-02 10:31:14 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance.
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
04-02 10:31:21 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
04-02 10:31:21 INFO metabase.core :: Starting Metabase in STANDALONE mode
04-02 10:31:21 INFO metabase.server :: Launching Embedded Jetty Webserver with config:
{:port 3000}

04-02 10:31:21 ERROR metabase.core :: Metabase Initialization FAILED
java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:3000
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:346)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:231)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.server.Server.doStart(Server.java:385)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at metabase.server$start_web_server_BANG_.invokeStatic(server.clj:113)
at metabase.server$start_web_server_BANG_.invoke(server.clj:99)
at metabase.core$start_normally.invokeStatic(core.clj:121)
at metabase.core$start_normally.invoke(core.clj:117)
at metabase.core$_main.invokeStatic(core.clj:156)
at metabase.core$_main.doInvoke(core.clj:150)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at metabase.core.main(Unknown Source)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
… 16 more
PS C:\Metabase> set MB_JETTY_PORT=3100
PS C:\Metabase> java -jar metabase.jar
04-02 10:34:22 DEBUG plugins.classloader :: Using NEWLY CREATED classloader as shared context classloader: clojure.lang.DynamicClassLoader@39ce27f2
04-02 10:34:22 INFO metabase.util :: Loading Metabase…
04-02 10:34:22 INFO metabase.util :: Maximum memory available to JVM: 14.1 GB
04-02 10:34:32 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance.
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
04-02 10:34:38 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
04-02 10:34:38 INFO metabase.core :: Starting Metabase in STANDALONE mode
04-02 10:34:38 INFO metabase.server :: Launching Embedded Jetty Webserver with config:
{:port 3000}

04-02 10:34:38 ERROR metabase.core :: Metabase Initialization FAILED
java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:3000
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:346)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:231)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at org.eclipse.jetty.server.Server.doStart(Server.java:385)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
at metabase.server$start_web_server_BANG_.invokeStatic(server.clj:113)
at metabase.server$start_web_server_BANG_.invoke(server.clj:99)
at metabase.core$start_normally.invokeStatic(core.clj:121)
at metabase.core$start_normally.invoke(core.clj:117)
at metabase.core$_main.invokeStatic(core.clj:156)
at metabase.core$_main.doInvoke(core.clj:150)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at metabase.core.main(Unknown Source)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
… 16 more

Hi @dturner
Could it be something to do with Powershell vs Command Prompt?
Then try this instead:
java -DMB_JETTY_PORT=3100 -jar metabase.jar

1 Like

That got me future than I was before but the port still did not change. Thank you so much for your quick response. I will try the command prompt.

Did you get this working? I have tired this command on Windows server but port does not change. I did it with Metabase running. No impact, turned it off ran command still starts on port 3000?

@endurancezone You're not writing if your are using PowerShell or Command Prompt.
https://www.metabase.com/docs/latest/operations-guide/environment-variables.html
Use the inline way as I described above.

@flamber apologies Command Prompt

@flamber so I have tried the following via CMD and PS



Restart Metabase still on port 3000? Did I miss something or a step?

@endurancezone Environment variables only persist in the window you are working in. To store them in new windows, then you need to do other things, but that's not specific to Metabase.

Follow what I wrote here: Cannot change MB_JETTY_PORT Port Number

@flamber Thank you that worked! Appreciate the patience and help.

Hey! I used this on terminal on mac but on opening up localhost 3100, it says this site can't be reached. Can you help?

@nidhi You are running Metabase on another server, not your local computer (aka localhost), so you have to go to the hostname/IP of the other server.

Thankyou @flamber for the quick response!
Can you please tell me if I can access the GUI of metabase of that server on my localhost ?

@nidhi You'll have to do some SSH tunneling with port forwarding. Search the internet about that, since it has nothing to do with Metabase.
I would recommend that you ask your DevOps team for help on setting up Metabase.
https://www.metabase.com/docs/latest/operations-guide/installing-metabase.html

Thanks @flamber. One last question can we upgrade metabase only using GUI? Becase I wanted to upgrade metabase version which is on that server.

@nidhi No: https://www.metabase.com/docs/latest/operations-guide/upgrading-metabase.html

1 Like

Thankyou! I saw that link previously but was confused.