Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b72afda511 |
4 changed files with 104 additions and 98 deletions
|
|
@ -12,10 +12,10 @@ LABEL MAINTAINER "Petr Hracek" <phracek@redhat.com>
|
||||||
LABEL summary="High Performance, Distributed Memory Object Cache" \
|
LABEL summary="High Performance, Distributed Memory Object Cache" \
|
||||||
name="$FGC/$NAME" \
|
name="$FGC/$NAME" \
|
||||||
version="0" \
|
version="0" \
|
||||||
release="1.$DISTTAG" \
|
release="2.$DISTTAG" \
|
||||||
architecture="$ARCH" \
|
architecture="$ARCH" \
|
||||||
com.redhat.component=$NAME \
|
com.redhat.component=$NAME \
|
||||||
usage="docker run -p 11211:11211 f26/memcached" \
|
usage="docker run -p 11211:11211 registry.fedoraproject.org/f26/memcached" \
|
||||||
help="Runs memcached, which listens on port 11211. No dependencies. See Help File below for more details." \
|
help="Runs memcached, which listens on port 11211. No dependencies. See Help File below for more details." \
|
||||||
description="memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." \
|
description="memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." \
|
||||||
io.k8s.description="memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." \
|
io.k8s.description="memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." \
|
||||||
|
|
|
||||||
184
README.md
184
README.md
|
|
@ -2,111 +2,85 @@
|
||||||
|
|
||||||
Memcached is High Performance, Distributed Memory Object Cache
|
Memcached is High Performance, Distributed Memory Object Cache
|
||||||
|
|
||||||
## Summary
|
## How to use the container
|
||||||
|
|
||||||
|
Pull the image from Docker Hub:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo docker pull registry.fedoraproject.org/f26/memcached
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -it -p 11211:11211 --name memcached registry.fedoraproject.org/f26/memcached
|
||||||
|
```
|
||||||
|
|
||||||
|
If you would like to debug memcached, use container option =e MEMCACHED_DEBUG_MODE:
|
||||||
|
```bash
|
||||||
|
docker run -it -p 11211:11211
|
||||||
|
[-e MEMCACHED_DEBUG_MODE]
|
||||||
|
--name memcached registry.fedoraproject.org/f26/memcached
|
||||||
|
```
|
||||||
|
|
||||||
|
If you would like to change memcached options, like cache_size, connections or threads, use environment variable -e MEMCACHED_CACHE_SIZE, -e MEMCACHED_CONNECTIONS, -e MEMCACHED_THREADS respectively:
|
||||||
|
```bash
|
||||||
|
docker run -it -p 11211:11211
|
||||||
|
[-e MEMCACHED_CACHE_SIZE=<size_in_MB>]
|
||||||
|
[-e MEMCACHED_CONNECTIONS=<max_simultaneous_connections>]
|
||||||
|
[-e MEMCACHED_THREADS=<max_concurrent_threads>]
|
||||||
|
--name memcached registry.fedoraproject.org/f26/memcached
|
||||||
|
```
|
||||||
|
|
||||||
|
## A demo
|
||||||
|
|
||||||
|
Here is a simple demo how to run memcached
|
||||||
|
|
||||||
|
* Copy systemd service which will take care of memcached container:
|
||||||
|
```bash
|
||||||
|
$ sudo cp -av memcached-container.service /usr/lib/systemd/system/
|
||||||
|
$ sudo systemctl daemon-reload
|
||||||
|
```
|
||||||
|
|
||||||
|
* We can start memcached now:
|
||||||
|
```bash
|
||||||
|
$ sudo systemctl start memcached-container
|
||||||
|
```
|
||||||
|
|
||||||
|
* You should be able to test memcached by commands (taken from http://www.journaldev.com/16/memcached-telnet-commands-with-example):
|
||||||
|
```bash
|
||||||
|
set Test 0 100 10
|
||||||
|
JournalDev
|
||||||
|
STORED
|
||||||
|
get Test
|
||||||
|
VALUE Test 0 10
|
||||||
|
JournalDev
|
||||||
|
END
|
||||||
|
replace Test 0 100 4
|
||||||
|
Temp
|
||||||
|
STORED
|
||||||
|
get Test
|
||||||
|
VALUE Test 0 4
|
||||||
|
Temp
|
||||||
|
END
|
||||||
|
stats items
|
||||||
|
STAT items:1:number 1
|
||||||
|
STAT items:1:age 19
|
||||||
|
STAT items:1:evicted 0
|
||||||
|
STAT items:1:evicted_time 0
|
||||||
|
STAT items:1:outofmemory 0
|
||||||
|
STAT items:1:tailrepairs 0
|
||||||
|
END
|
||||||
|
flush_all
|
||||||
|
OK
|
||||||
|
get Test
|
||||||
|
END
|
||||||
|
version
|
||||||
|
VERSION 1.4.25
|
||||||
|
quit
|
||||||
|
```
|
||||||
|
|
||||||
|
## Repository structure
|
||||||
|
|
||||||
- Dockerfile - build container image with memcached.
|
- Dockerfile - build container image with memcached.
|
||||||
- openshift-template.yml - Template for OpenShift to memcached.
|
- openshift-template.yml - Template for OpenShift to memcached.
|
||||||
|
|
||||||
|
|
||||||
## How to use the container over standard 11211 port
|
|
||||||
|
|
||||||
Command for running memcached docker container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run -it -e CACHE_SIZE=128 \
|
|
||||||
-p 11211:11211
|
|
||||||
```
|
|
||||||
|
|
||||||
If you would like to increase a CACHE_SIZE use environment variable -e CACHE_SIZE:
|
|
||||||
```bash
|
|
||||||
docker run -it -e CACHE_SIZE=128 \
|
|
||||||
-p 11211:11211
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to run memcached as standalone container
|
|
||||||
|
|
||||||
Copy memcached-container.service to ```/usr/lib/systemd/user/``` directory
|
|
||||||
```bash
|
|
||||||
sudo cp memcached-container.service /usr/lib/systemd/user/
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
```
|
|
||||||
|
|
||||||
Command for running memcached as standalone container:
|
|
||||||
```bash
|
|
||||||
systemctl start --user memcached-container
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to stop memcached as standalone container
|
|
||||||
Command for stopping memcached as standalone container:
|
|
||||||
```bash
|
|
||||||
systemctl stop --user memcached-container
|
|
||||||
```
|
|
||||||
## How to test the memcached
|
|
||||||
|
|
||||||
Commands for testing memcached docker container:
|
|
||||||
|
|
||||||
To store data in memcached server with telnet:
|
|
||||||
```bash
|
|
||||||
set KEY META_DATA EXPIRY_TIME LENGTH_IN_BYTES
|
|
||||||
```
|
|
||||||
|
|
||||||
To get data
|
|
||||||
```bash
|
|
||||||
get KEY
|
|
||||||
```
|
|
||||||
|
|
||||||
To overwrite existing key
|
|
||||||
```bash
|
|
||||||
replace KEY META_DATA EXPIRE_TIME LENGTH_IN_BYTES
|
|
||||||
```
|
|
||||||
|
|
||||||
To delete key
|
|
||||||
```bash
|
|
||||||
delete KEY
|
|
||||||
```
|
|
||||||
|
|
||||||
To get the server statistics
|
|
||||||
```bash
|
|
||||||
stats
|
|
||||||
stats items
|
|
||||||
stats slabs
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
To clear the metadata statistics
|
|
||||||
```bash
|
|
||||||
flush all
|
|
||||||
```
|
|
||||||
|
|
||||||
Memcached Server Telnet Example (taken from http://www.journaldev.com/16/memcached-telnet-commands-with-example)
|
|
||||||
```bash
|
|
||||||
set Test 0 100 10
|
|
||||||
JournalDev
|
|
||||||
STORED
|
|
||||||
get Test
|
|
||||||
VALUE Test 0 10
|
|
||||||
JournalDev
|
|
||||||
END
|
|
||||||
replace Test 0 100 4
|
|
||||||
Temp
|
|
||||||
STORED
|
|
||||||
get Test
|
|
||||||
VALUE Test 0 4
|
|
||||||
Temp
|
|
||||||
END
|
|
||||||
stats items
|
|
||||||
STAT items:1:number 1
|
|
||||||
STAT items:1:age 19
|
|
||||||
STAT items:1:evicted 0
|
|
||||||
STAT items:1:evicted_time 0
|
|
||||||
STAT items:1:outofmemory 0
|
|
||||||
STAT items:1:tailrepairs 0
|
|
||||||
END
|
|
||||||
flush_all
|
|
||||||
OK
|
|
||||||
get Test
|
|
||||||
END
|
|
||||||
version
|
|
||||||
VERSION 1.4.25
|
|
||||||
quit
|
|
||||||
```
|
|
||||||
|
|
|
||||||
23
files/memcached.sh
Executable file
23
files/memcached.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MEMCACHED_ARGS=
|
||||||
|
|
||||||
|
|
||||||
|
if [[ ! -z "${MEMCACHED_DEBUG_MODE}" ]]; then
|
||||||
|
MEMCACHED_ARGS+=" -vv"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "${MEMCACHED_CACHE_SIZE}" ]]; then
|
||||||
|
MEMCACHED_ARGS+=" -m $MEMCACHED_CACHE_SIZE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "${MEMCACHED_CONNECTIONS}" ]]; then
|
||||||
|
MEMCACHED_ARGS+=" -c $MEMCACHED_CONNECTIONS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "${MEMCACHED_THREADS}" ]]; then
|
||||||
|
MEMCACHED_ARGS+=" -t $MEMCACHED_THREADS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run memcached binary
|
||||||
|
/usr/bin/memcached -u daemon $MEMCACHED_ARGS
|
||||||
17
help.md
17
help.md
|
|
@ -9,7 +9,7 @@ memcached - High Performance, Distributed Memory Object Cache.
|
||||||
Memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
|
Memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
|
||||||
|
|
||||||
The container itself consists of:
|
The container itself consists of:
|
||||||
- fedora/24 base image
|
- fedora/f26 base image
|
||||||
- memcached RPM package
|
- memcached RPM package
|
||||||
|
|
||||||
Files added to the container during docker build include: /files/memcached.sh
|
Files added to the container during docker build include: /files/memcached.sh
|
||||||
|
|
@ -17,14 +17,23 @@ Files added to the container during docker build include: /files/memcached.sh
|
||||||
# USAGE
|
# USAGE
|
||||||
To get the memcached container image on your local system, run the following:
|
To get the memcached container image on your local system, run the following:
|
||||||
|
|
||||||
docker pull hub.docker.io/phracek/memcached
|
docker pull registry.fedoraproject.org/f26/memcached
|
||||||
|
|
||||||
|
|
||||||
# ENVIRONMENT VARIABLES
|
# ENVIRONMENT VARIABLES
|
||||||
The memcached container includes the following environment variables:
|
The memcached container includes the following environment variables:
|
||||||
|
|
||||||
CACHE_SIZE=128
|
For turn on verbose mode, use environment variable
|
||||||
The variable sets size of cached used by memcached.
|
-e MEMCACHED_DEBUG_MODE
|
||||||
|
|
||||||
|
For setting cache size, use environment variable
|
||||||
|
-e MEMCACHED_CACHE_SIZE
|
||||||
|
|
||||||
|
For setting maximum connections, use environment variable
|
||||||
|
-e MEMCACHED_CONNECTIONS
|
||||||
|
|
||||||
|
For setting maximum threads, use environment variable
|
||||||
|
-e MEMCACHED_THREADS
|
||||||
|
|
||||||
# SECURITY IMPLICATIONS
|
# SECURITY IMPLICATIONS
|
||||||
Lists of security-related attributes that are opened to the host.
|
Lists of security-related attributes that are opened to the host.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue