Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curveadm playbook deploy memcached #240

Open
Cyber-SiKu opened this issue Jun 13, 2023 · 4 comments · May be fixed by #384
Open

curveadm playbook deploy memcached #240

Cyber-SiKu opened this issue Jun 13, 2023 · 4 comments · May be fixed by #384

Comments

@Cyber-SiKu
Copy link
Collaborator

Cyber-SiKu commented Jun 13, 2023

deploy_memcached

目前,部署memcahced 一个服务就要对应一个host,修改起来繁琐,可以对这方面进行优化,使得对一台机器部署多个服务时仅需要修改一个host即可。

At present, deploying a memcahced service requires corresponding to a host, which is cumbersome to modify. This aspect can be optimized so that only one host needs to be modified when deploying multiple services on a machine.

Registration procedure

Step 1. Add a comment when you sign up.The purpose of comments is for us to understand you and determine whether you have the basic ability to complete this issue.

  • If you are a student, please introduce your school, major, programming language, technical fields of interest, what you are good at, and why you chose this issue.
  • If you are already working, please introduce your company, career, work content, technical fields of interest, and why you chose this issue.

Step 2. Use WeChat to add the Curve community assistant "Curve" as a WeChat friend, tell your GitHub ID, and send the Issue link of your choice. The assistant will invite you to communicate with the mentor by WeChat.

Step 3. In order to better complete each development task, the mentor will select the developer who best matches the issue based on everyone's comment on GitHub and communication status by WeChat. If you are not selected, please select another issue.

Tips

  • Before developing, please read the dev guideline( https://ask.opencurve.io/t/topic/201) carefully and communicate with your mentor.
  • Please submit a draft PR before 11.29, and the mentor will review it within 2-5 working days and may guide you to modify the PR based on the actual situation.
  • If you successfully merge into PR before 12.27 and you will receive gifts carefully prepared by the Curve community.
@0fatal
Copy link

0fatal commented Oct 30, 2023

hi, I'm a student majoring in software engineering in hdu, who is interested in distributed system. I'm good at golang and javascript. Familiar at kubernetes and linux, I wish to contribute to this task.

@EricWai
Copy link

EricWai commented Nov 2, 2023

Hello, I am a student from UESTC. I am good at golang language. I have learned k8s related knowledge and am interested in this issue.
I think a good solution is to reformat the yaml files. In current versions, deploying multiple services on a single host(10.0.1.1) requires the following configuration in hosts.yaml:

- host: server-host1
  hostname: 10.0.1.1
  labels:
    - memcached
  envs:
    - IMAGE=memcached:1.6.17
    - LISTEN=10.0.1.1
    ...

- host: server-host2
  hostname: 10.0.1.1
  labels:
    - memcached
  envs:
    - IMAGE=memcached:1.6.17
    - LISTEN=10.0.1.1
    ...

I think it can be modified as:

- host: server-host1
  hostname: 10.0.1.1
  - servername: server1
    labels:
      - memcached
    envs:
      - IMAGE=memcached:1.6.17
      - LISTEN=10.0.1.1
      ...

  - servername: server1
    labels:
      - memcached
    envs:
      - IMAGE=memcached:1.6.17
      - LISTEN=10.0.1.1
      ...

so that only one host needs to be modified when deploying multiple services on a machine.

I hope the task will be assigned to me!

@Cyber-SiKu
Copy link
Collaborator Author

Hello, I am a student from UESTC. I am good at golang language. I have learned k8s related knowledge and am interested in this issue. I think a good solution is to reformat the yaml files. In current versions, deploying multiple services on a single host(10.0.1.1) requires the following configuration in hosts.yaml:

- host: server-host1
  hostname: 10.0.1.1
  labels:
    - memcached
  envs:
    - IMAGE=memcached:1.6.17
    - LISTEN=10.0.1.1
    ...

- host: server-host2
  hostname: 10.0.1.1
  labels:
    - memcached
  envs:
    - IMAGE=memcached:1.6.17
    - LISTEN=10.0.1.1
    ...

I think it can be modified as:

- host: server-host1
  hostname: 10.0.1.1
  - servername: server1
    labels:
      - memcached
    envs:
      - IMAGE=memcached:1.6.17
      - LISTEN=10.0.1.1
      ...

  - servername: server1
    labels:
      - memcached
    envs:
      - IMAGE=memcached:1.6.17
      - LISTEN=10.0.1.1
      ...

so that only one host needs to be modified when deploying multiple services on a machine.

I hope the task will be assigned to me!

In this case, you also need to write a lot of configuration files. You can refer to the design of topology's replica. Add ${service_replica_sequence} to the port and file location. to distinguish.

@EricWai
Copy link

EricWai commented Nov 10, 2023

Thanks to guidance, the code has been modified to support replicas and ${replicas_sequence}. Now, when deploying the memcached cluster, hosts.yaml can be written as follows:

global:
  user: curve
  ssh_port: 22
  private_key_file: /home/curve/.ssh/id_rsa
  
hosts:
  - host: server-host1
    hostname: 10.0.1.1
    labels:
      - memcached
    envs:
      - SUDO_ALIAS=sudo
      - ENGINE=docker
      - IMAGE=memcached:1.6.17
      - EXPORTER_IMAGE=quay.io/prometheus/memcached-exporter:v0.13.0
      - LISTEN=10.0.1.1
      - PORT=1121${replicas_sequence}
      - EXPORTER_PORT=915${replicas_sequence}
      - USER=root
      - MEMORY_LIMIT=32768 # item memory in megabytes
      - MAX_ITEM_SIZE=8m # adjusts max item size (default: 1m, min: 1k, max: 1024m)
      - EXT_PATH=/mnt/memcachefile/cachefile:102${replicas_sequence}G
      - EXT_WBUF_SIZE=8 # size in megabytes of page write buffers.
      - EXT_ITEM_AGE=1 # store items idle at least this long (seconds, default: no age limit)
      - VERBOSE="v"
    replicas: 3

  - host: server-host2
    hostname: 10.0.1.2
    labels:
      - memcached
    envs:
      - SUDO_ALIAS=sudo
      - ENGINE=docker
      - IMAGE=memcached:1.6.17
      - EXPORTER_IMAGE=quay.io/prometheus/memcached-exporter:v0.13.0
      - LISTEN=10.0.1.2
      - PORT=11211
      - EXPORTER_PORT=9151
      - USER=root
      - MEMORY_LIMIT=32768 # item memory in megabytes
      - MAX_ITEM_SIZE=8m # adjusts max item size (default: 1m, min: 1k, max: 1024m)
      - EXT_PATH=/mnt/memcachefile/cachefile:102${replicas_sequence}G
      - EXT_WBUF_SIZE=8 # size in megabytes of page write buffers.
      - EXT_ITEM_AGE=1 # store items idle at least this long (seconds, default: no age limit)
      - VERBOSE="v"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment