Mac OS X에서 Memcached Process/Server를 설치 및 구성하는 방법은 무엇입니까?
게시 됨: 2021-04-06
Memcached는 널리 사용되는 distributed memory object caching solution
중 하나입니다. 지난 3년 동안 다양한 프로젝트에서 활발히 사용하고 있습니다.
다음은 애플리케이션에 Memcached를 사용할 때의 주요 이점입니다.
- 매우 가벼운 무게
- 쉽고 간단한 설치 단계
- 한 번의 클릭으로 간편한 서버 설정
- 필요에 따라 Mac OS X, Windows 또는 클라우드 서버에 배포
- PHP, Java 편리한 클라이언트 코드 사용 가능
- API 명령이 포함된 멋진 문서
- 가벼운 메모리 및 CPU 풋프린트
- 쉬운 유지 보수
- 오픈 소스 및 무료
Memcached에 대해 아래 질문이 있는 경우 올바른 위치에 있습니다.
- memcached를 설치, 구성, 확인하는 방법은 무엇입니까?
- Mac OS X에 Memcached 설치
-
brew
를 사용하여 Memcached를 설치하는 방법은 무엇입니까?
시작하자:
접근법-1)
1단계 – 설치
Mac 터미널을 열고 brew install memcached
명령을 입력합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
bash $ brew install memcached == > Installing dependencies for memcached : openssl and libevent == > Installing memcached dependency : openssl == > Downloading https : //homebrew.bintray.com/bottles/openssl-1.0.2q.mojave.bottle.tar.gz ######################################################################## 100.0% == > Pouring openssl - 1.0.2q.mojave.bottle.tar.gz == > Caveats A CA file has been bootstrapped using certificates from the SystemRoots keychain . To add additional certificates ( e . g . the certificates added in the System keychain ) , place . pem files in / usr / local / etc / openssl / certs and run / usr / local / opt / openssl / bin / c_rehash openssl is keg - only , which means it was not symlinked into / usr / local , because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries . If you need to have openssl first in your PATH run : echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' > > ~ / . bash_profile For compilers to find openssl you may need to set : export LDFLAGS = "-L/usr/local/opt/openssl/lib" export CPPFLAGS = "-I/usr/local/opt/openssl/include" == > Summary / usr / local / Cellar / openssl / 1.0.2q : 1 , 794 files , 12.1MB == > Installing memcached dependency : libevent == > Downloading https : //homebrew.bintray.com/bottles/libevent-2.1.8.mojave.bottle.tar.gz ######################################################################## 100.0% == > Pouring libevent - 2.1.8.mojave.bottle.tar.gz / usr / local / Cellar / libevent / 2.1.8 : 846 files , 2.2MB == > Installing memcached == > Downloading https : //homebrew.bintray.com/bottles/memcached-1.5.12.mojave.bottle.tar.gz ######################################################################## 100.0% == > Pouring memcached - 1.5.12.mojave.bottle.tar.gz == > Caveats To have launchd start memcached now and restart at login : brew services start memcached Or , if you don 't want/need a background service you can just run: /usr/local/opt/memcached/bin/memcached ==> Summary /usr/local/Cellar/memcached/1.5.12: 11 files, 198.9KB ==> Caveats ==> openssl A CA file has been bootstrapped using certificates from the SystemRoots keychain. To add additional certificates (e.g. the certificates added in the System keychain), place .pem files in /usr/local/etc/openssl/certs and run /usr/local/opt/openssl/bin/c_rehash openssl is keg-only, which means it was not symlinked into /usr/local, because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. If you need to have openssl first in your PATH run: echo ' export PATH = "/usr/local/opt/openssl/bin:$PATH" ' >> ~/.bash_profile For compilers to find openssl you may need to set: export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include" ==> memcached To have launchd start memcached now and restart at login: brew services start memcached Or, if you don' t want / need a background service you can just run : / usr / local / opt / memcached / bin / memcached |
2단계: 확인
성공적으로 시작되었는지 확인합니다.
명령 ps -few | grep memcached
입력하십시오. ps -few | grep memcached
.
1 2 |
bash - 3.2 $ ps - few | grep memcached 110048994 88258 88202 0 12 : 31PM ttys000 0 : 00.00 grep memcached |
결과의 일부로 memcached 프로세스가 표시됩니다.

기본적으로 Memcached는 port 11211
에서 실행됩니다.
brew
를 사용하는 것은 Mac OS X에 Memcached를 설치하는 가장 안전하고 쉬운 방법입니다. brew가 로컬에 설치되어 있지 않다면 아래 수동 접근 방식을 따르십시오.
접근법-2)
libevent
를 수동으로 설치합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
bash - 3.2 $ wget https : //github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz -- 2018 - 12 - 05 12 : 45 : 32 -- https : //github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz Resolving github . com ( github . com ) . . . 192.30.255.113 , 192.30.255.112 Connecting to github . com ( github . com ) | 192.30.255.113 | : 443... connected . HTTP request sent , awaiting response . . . 302 Found Location : https : //github-production-release-asset-2e65be.s3.amazonaws.com/1856976/f9ea6922-e66b-11e6-9f5c-722c00daa657?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20181205%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20181205T184532Z&X-Amz-Expires=300&X-Amz-Signature=4b210170c4bf645011fe368024396eb8854502f5efc0abc200bd0ab91fb4c66f&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dlibevent-2.1.8-stable.tar.gz&response-content-type=application%2Foctet-stream [following] -- 2018 - 12 - 05 12 : 45 : 32 -- https : //github-production-release-asset-2e65be.s3.amazonaws.com/1856976/f9ea6922-e66b-11e6-9f5c-722c00daa657?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20181205%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20181205T184532Z&X-Amz-Expires=300&X-Amz-Signature=4b210170c4bf645011fe368024396eb8854502f5efc0abc200bd0ab91fb4c66f&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dlibevent-2.1.8-stable.tar.gz&response-content-type=application%2Foctet-stream Resolving github - production - release - asset - 2e65be.s3.amazonaws.com ( github - production - release - asset - 2e65be.s3.amazonaws.com ) . . . 52.216.97.155 Connecting to github - production - release - asset - 2e65be.s3.amazonaws.com ( github - production - release - asset - 2e65be.s3.amazonaws.com ) | 52.216.97.155 | : 443... connected . HTTP request sent , awaiting response . . . 200 OK Length : 1026485 ( 1002K ) [ application / octet - stream ] Saving to : ‘ libevent - 2.1.8 - stable . tar . gz ’ libevent - 2.1.8 - stable . tar . gz 100 % [ ============================================================================================== > ] 1002K 126KB / s in 7.9s 2018 - 12 - 05 12 : 45 : 41 ( 127 KB / s ) - ‘ libevent - 2.1.8 - stable . tar . gz ’ saved [ 1026485 / 1026485 ] bash - 3.2 $ tar xvfz libevent - 2.1.8 - stable . tar . gz bash - 3.2 $ cd libevent - 2.1.8 - stable bash - 3.2 $ . / configure bash - 3.2 $ make bash - 3.2 $ sudo make install |
memcached
를 수동으로 설치합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
bash - 3.2 $ wget https : //memcached.org/files/memcached-1.5.12.tar.gz -- 2018 - 12 - 05 12 : 49 : 28 -- https : //memcached.org/files/memcached-1.5.12.tar.gz Resolving memcached . org ( memcached . org ) . . . 107.170.231.145 Connecting to memcached . org ( memcached . org ) | 107.170.231.145 | : 443... connected . HTTP request sent , awaiting response . . . 200 OK Length : 457719 ( 447K ) [ application / octet - stream ] Saving to : ‘ memcached - 1.5.12.tar.gz ’ memcached - 1.5.12.tar.gz 100 % [ ============================================================================================== > ] 446.99K 810KB / s in 0.6s 2018 - 12 - 05 12 : 49 : 29 ( 810 KB / s ) - ‘ memcached - 1.5.12.tar.gz ’ saved [ 457719 / 457719 ] bash - 3.2 $ tar xvfz memcached - 1.5.12.tar.gz bash - 3.2 $ cd memcached - 1.5.12 bash - 3.2 $ . / configure bash - 3.2 $ make bash - 3.2 $ sudo make install |
이 단계에서 memcached가 성공적으로 설치되었습니다.
다음 단계는 memcached 프로세스를 start
하는 것입니다. 아래 명령을 실행하면 memcached 프로세스가 포트 12345에서 시작됩니다.
1 |
bash - 3.2 $ memcached - p 12345 |
즐겁고 행복한 코딩 여러분!! Memcached 설치에 문제가 있으면 알려주세요.
다음은? 3가지 접근 방식을 사용하여 매우 간단한 Java 클라이언트를 만듭니다.
- net.spy.spymemcached 라이브러리를 사용하는 Memcached Java 클라이언트
- com.whalin.Memcached-Java-Client 및 com.googlecode.xmemcached 라이브러리를 사용하는 Memcached 자바 클라이언트