# Unable to connect to CrateDB from another host

**URL:** <https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735>\
**Category:** Configuration\
**Created:** [March 26, 2024, 11:21am UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735 "2024-03-26T11:21:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![HughMacd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hughmacd/32/1206_2.png) [@HughMacd](https://community.cratedb.com/u/HughMacd)\
**Post date:** [March 26, 2024, 11:21am UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/1 "2024-03-26T11:21:03Z")

</div>

Hi,

I’m using Crate in a pretty simple setup - a single host, on a Raspberry Pi, nothing more.

I can successfully connect to it from localhost using http. I’m trying to figure out the configuration to allow me to connect from another host.

I can’t access the admin UI from another host, or connect using the crate python module.

I’ve been looking through `crate.yml` to try to identify what to change to allow this, and can’t figure it out.

My first thought was that I needed to set

```auto
network.host: 192.168.0.200

```

However, this failed with:

```auto
Mar 26 11:09:04 raspberrypi crate[3595]: [2024-03-26T11:09:04,942][INFO][o.e.n.Node] [Höfats] starting ...
Mar 26 11:09:05 raspberrypi crate[3595]: [2024-03-26T11:09:05,017][INFO][psql] [Höfats] publish_address {192.168.0.200:5432}, bound_addresses {192.168.0.200:5432}
Mar 26 11:09:05 raspberrypi crate[3595]: [2024-03-26T11:09:05,029][INFO][o.e.h.n.Netty4HttpServerTransport] [Höfats] publish_address {192.168.0.200:4200}, bound_addresses {192.168.0.200:4200}
Mar 26 11:09:05 raspberrypi crate[3595]: [2024-03-26T11:09:05,040][INFO][o.e.t.TransportService] [Höfats] publish_address {192.168.0.200:4300}, bound_addresses {192.168.0.200:4300}
Mar 26 11:09:05 raspberrypi crate[3595]: [2024-03-26T11:09:05,300][INFO][o.e.b.BootstrapChecks] [Höfats] bound or publishing to a non-loopback address, enforcing bootstrap checks
Mar 26 11:09:05 raspberrypi crate[3595]: ERROR: [1] bootstrap checks failed

```

I get the same error with using `_wlan0_` or `_site_`

Thinking that this wasn’t the issue, I then tried various options in the `auth` section of the config, changing the whole `auth` section to look like this:

```auto
auth:
  host_based:
    config:
      0:
        user: crate
        address: _local_
        method: trust
      1:
        user: my_user
        address: 192.168.0.201
        method: trush
      99:
        method: password

```

I also tried with the new section being `password` as the method.

None of these have worked for me - when I try to connect from another host, I get a timeout every time (using exactly the same script (apart from the host, username and password) to test).

Any tips as to how to allow this?

Thanks

EDIT: I found another thread on here that mentioned that you could set multiple `network.host` values, so I tried doing:

```auto
network.host: _local_, _wlan0_

```

I tried this (the comment in the config file, and the documentation don’t make it clear that multiple values are allowed), but got this error in the log (similar to above):

```auto
Mar 26 11:33:18 raspberrypi crate[4928]: [2024-03-26T11:33:18,153][INFO][psql] [Krofička] publish_address {192.168.0.200:5432}, bound_addresses {192.168.0.200:5432}, {[::1]:5432}, {127.0.0.1:5432}, {[fe80::1914:7916:eb39:e149]:5432}
Mar 26 11:33:18 raspberrypi crate[4928]: [2024-03-26T11:33:18,189][INFO][o.e.h.n.Netty4HttpServerTransport] [Krofička] publish_address {192.168.0.200:4200}, bound_addresses {192.168.0.200:4200}, {[::1]:4200}, {127.0.0.1:4200}, {[fe80::1914:7916:eb39:e149]:4200}
Mar 26 11:33:18 raspberrypi crate[4928]: [2024-03-26T11:33:18,200][INFO][o.e.t.TransportService] [Krofička] publish_address {192.168.0.200:4300}, bound_addresses {192.168.0.200:4300}, {[::1]:4300}, {127.0.0.1:4300}, {[fe80::1914:7916:eb39:e149]:4300}
Mar 26 11:33:18 raspberrypi crate[4928]: [2024-03-26T11:33:18,430][INFO][o.e.b.BootstrapChecks] [Krofička] bound or publishing to a non-loopback address, enforcing bootstrap checks
Mar 26 11:33:18 raspberrypi crate[4928]: ERROR: [1] bootstrap checks failed

```

---

<div class="post-metadata">

**Author:** ![surister](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/surister/32/1087_2.png) [@surister](https://community.cratedb.com/u/surister)\
**Post date:** [March 26, 2024, 11:28am UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/2 "2024-03-26T11:28:40Z")

</div>

If you are trying to connect to CrateDB via HTTP from outside localhost you need to set up CORS.

> **[Node-specific settings](https://cratedb.com/docs/crate/reference/en/5.6/config/node.html#cross-origin-resource-sharing-cors)**
>
> Table of contents Basics, Node types, General, Networking- Hosts, Ports, Advanced TCP settings, Transport settings., Paths, Plug-ins, CPU, Memory, Garbage collection, Authentication- Trust authentication, Host-based authentication- HBA entries..,...

In docker:  
`docker run -p 4200:4200 crate -Chttp.cors.enabled=true -Chttp.cors.allow-origin=192.168.88.257`

Change the IP for the one you are trying to connect from, alternatively for testing purposes you can do ‘\*’ and accept all.

---

<div class="post-metadata">

**Author:** ![HughMacd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hughmacd/32/1206_2.png) [@HughMacd](https://community.cratedb.com/u/HughMacd)\
**Post date:** [March 26, 2024, 11:41am UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/3 "2024-03-26T11:41:34Z")

</div>

Thanks.

Is this something that I should be able to set in crate.yml instead of running on the command-line (I’m not running it through Docker)

I tried running it with the modified command-line, and still couldn’t connect.

---

<div class="post-metadata">

**Author:** ![surister](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/surister/32/1087_2.png) [@surister](https://community.cratedb.com/u/surister)\
**Post date:** [March 26, 2024, 11:45am UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/4 "2024-03-26T11:45:21Z")

</div>

Yeah, in here you can see how we set other http options, set them here without the ‘-C’, [crate/app/src/main/dist/config/crate.yml at 921b53f428e2e65e9c57d10e23872a0d3fb5d022 · crate/crate · GitHub](https://github.com/crate/crate/blob/921b53f428e2e65e9c57d10e23872a0d3fb5d022/app/src/main/dist/config/crate.yml#L300)

---

<div class="post-metadata">

**Author:** ![HughMacd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hughmacd/32/1206_2.png) [@HughMacd](https://community.cratedb.com/u/HughMacd)\
**Post date:** [March 26, 2024, 11:57am UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/5 "2024-03-26T11:57:18Z")

</div>

Thanks - I tried setting the cors settings like that and on the command-line, and I still couldn’t connect from another host.

---

<div class="post-metadata">

**Author:** ![hernanc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hernanc/32/676_2.png) [@hernanc](https://community.cratedb.com/u/hernanc)\
**Post date:** [March 26, 2024, 1:20pm UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/6 "2024-03-26T13:20:02Z")

</div>

Hi,

> If you are binding to a network reachable IP address, CrateDB performs a number of bootstrap checks during startup.

Could you check the settings from [Bootstrap checks — CrateDB: Guide](https://cratedb.com/docs/guide/admin/bootstrap-checks.html) ?

---

<div class="post-metadata">

**Author:** ![HughMacd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hughmacd/32/1206_2.png) [@HughMacd](https://community.cratedb.com/u/HughMacd)\
**Post date:** [March 26, 2024, 1:22pm UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/7 "2024-03-26T13:22:33Z")

</div>

I’ve just realised this and have been working through it.

My actual boostrap error (which I didn’t include above) was:

```auto
[1]: initial heap size [268435456] not equal to maximum heap size [2113929216]; this can cause resize pauses and prevents mlockall from locking the entire heap. Set the heap size via the CRATE_HEAP_SIZE environment variable. See https://crate.io/docs/crate/howtos/en/latest/performance/memory.html

```

I’ve now changed my commandline to include `-Xms2048m -Xmx2048m` (previously it just had `-Xms256m`) and it appears to work

Thanks

---

<div class="post-metadata">

**Author:** ![HughMacd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hughmacd/32/1206_2.png) [@HughMacd](https://community.cratedb.com/u/HughMacd)\
**Post date:** [March 26, 2024, 1:28pm UTC](https://community.cratedb.com/t/unable-to-connect-to-cratedb-from-another-host/1735/8 "2024-03-26T13:28:37Z")

</div>

And, for future reference, my actual fix in systemd was to edit my `crate.service` to add in:

```auto
Environment="CRATE_HEAP_SIZE=2048m"

```
