# setting up memcached in HA format

**URL:** <https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148>\
**Category:** Dragonfly Technical\
**Created:** [March 22, 2024, 7:40am UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148 "2024-03-22T07:40:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [March 22, 2024, 7:40am UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/1 "2024-03-22T07:40:05Z")

</div>

hey all,

I was trying to setup memcached in an HA format, ie: with the dragonfly operator sending the requests to underlying dragonflydb instances. I’ve set it up using the kubectl apply commands as seen here:

[https://www.dragonflydb.io/docs/getting-started/kubernetes-operator](https://www.dragonflydb.io/docs/getting-started/kubernetes-operator)

I’ve set up the instances with the following parameters:

```
  --alsologtostderr
  --primary_port_http_enabled=false
  --admin_port=9999
  --admin_nopass
  --maxmemory=1Gi
  --proactor_threads=1
  --memcached_port=11211

```

however when I try to connect to the HA primary, it doesn’t export 11211:

telnet dragonfly-sample 11211  
Connection refused.

I know that redis is available:

telnet dragonfly-sample 6379  
Connected to dragonfly-sample

so… whats going on here? is memcached support available in the operator and if so what am I doing wrong here?

thanks much for any help here

---

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [March 22, 2024, 7:59am UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/2 "2024-03-22T07:59:42Z")

</div>

looking at the operator source code it looks like this isn’t supported. three questions, is this correct, if so why is it not supported, and how easy would that support be to add? well, ok, a fourth - if I’m incorrect in saying that it isn’t supported, how do you actually implement this?

---

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [March 23, 2024, 1:41am UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/3 "2024-03-23T01:41:13Z")

</div>

hey @meaningful-vole @dignified-nautilus - could you confirm that this is the case? does dragonfly support memcached in HA format the way that we are describing above?

if not how easy would it be to implement and is it on the deployment schedule?

thanks much for any info here

---

<div class="post-metadata">

**Author:** ![dignified-nautilus](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@dignified-nautilus](https://dragonfly.discourse.group/u/dignified-nautilus)\
**Post date:** [March 24, 2024, 7:21pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/4 "2024-03-24T19:21:19Z")

</div>

@zingy-umbrellabird Dragonfly does supprot HA with memcached . Might be some changes that need to be done on the operator side to be able to connect with the memcached port, @happy-giraffe can answer this

---

<div class="post-metadata">

**Author:** ![happy-giraffe](https://avatars.discourse-cdn.com/v4/letter/h/c89c15/32.png) [@happy-giraffe](https://dragonfly.discourse.group/u/happy-giraffe)\
**Post date:** [March 24, 2024, 7:22pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/5 "2024-03-24T19:22:24Z")

</div>

Ah. So I dont think we expose the port on the service yet! Should be easy to add

---

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [March 27, 2024, 8:26pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/6 "2024-03-27T20:26:18Z")

</div>

@happy-giraffe could you possibly let me know when this is integrated and when I can try it via the dragonfly kubernetes operator setup above? I’d love to try it out

---

<div class="post-metadata">

**Author:** ![happy-giraffe](https://avatars.discourse-cdn.com/v4/letter/h/c89c15/32.png) [@happy-giraffe](https://dragonfly.discourse.group/u/happy-giraffe)\
**Post date:** [March 27, 2024, 8:29pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/7 "2024-03-27T20:29:48Z")

</div>

Expect a fix this week! 🙂 WIll update you once a release is done with it.

---

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [March 28, 2024, 7:02pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/8 "2024-03-28T19:02:12Z")

</div>

k thanks @happy-giraffe

---

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [April 1, 2024, 9:08pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/9 "2024-04-01T21:08:16Z")

</div>

@tarun - any idea on a time? we are in the process of demoing memcached replacements

---

<div class="post-metadata">

**Author:** ![devoted-kiwi](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@devoted-kiwi](https://dragonfly.discourse.group/u/devoted-kiwi)\
**Post date:** [April 3, 2024, 8:58am UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/10 "2024-04-03T08:58:15Z")

</div>

Hi @zingy-umbrellabird , we will release this week (once dragonfly v1.16 is released)

---

<div class="post-metadata">

**Author:** ![devoted-kiwi](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@devoted-kiwi](https://dragonfly.discourse.group/u/devoted-kiwi)\
**Post date:** [April 3, 2024, 3:27pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/11 "2024-04-03T15:27:12Z")

</div>

Hey, v1.1.2 released - [https://github.com/dragonflydb/dragonfly-operator/releases/tag/v1.1.2](https://github.com/dragonflydb/dragonfly-operator/releases/tag/v1.1.2). use `memcachedPort` field instead of the `--memcached_port` arg

---

<div class="post-metadata">

**Author:** ![zingy-umbrellabird](https://avatars.discourse-cdn.com/v4/letter/z/e36b37/32.png) [@zingy-umbrellabird](https://dragonfly.discourse.group/u/zingy-umbrellabird)\
**Post date:** [April 9, 2024, 10:21pm UTC](https://dragonfly.discourse.group/t/setting-up-memcached-in-ha-format/148/12 "2024-04-09T22:21:54Z")

</div>

@devoted-kiwi - ok I think I’ve got it, you need to modify the ‘kind: dragonfly’ section to add this when used with the operator correct?

its a little bit confusing because all of the other arguments to the operator are in the dragonfly-operator.yaml file so it took a bit of time to figure out.

However, when I’m running it in our environment I’m getting:

I20240409 18:01:29.512708 1 proactor\_pool.cc:146] Running 16 io threads  
E20240409 18:01:29.512779 1 dfly\_main.cc:168] There are 16 threads, so 4.00GiB are required. Exiting…

this seems to be insensitive to the changes that I’m making there wrt to the requests and limits in that same file. ie: if I set the requests and limits to:

resources:  
requests:  
cpu: 100m  
memory: 50Mi  
limits:  
cpu: 100m  
memory: 75Mi

it does not matter. I still hit this 4GB error and we don’t have 4GB to spare for this in our environment.

Also, it looks like the actual dragonfly resources are put into the default namespace, not into the namespace where the operator itself is located. How can you co-locate the two?

The documentation looks very spare on these two issues. I would have thought that [dragonflydb.io/v1alpha1](http://dragonflydb.io/v1alpha1) would have inherited the namespace that the operator was in and put the associated resources in the same one - the default setup you have there collides if you have more than one instance of it.

Likewise, I would have thought that the number of threads, etc. would have been exposed to the user so they could be configured.

Anyways I’m probably missing some info from perusing the docs, so if you could help out here it would be greatly appreciated.
