라이브러리
[PHP_CONFIG] memcache.allow_failover - Memcache 서버 장애 발생 시 대체 서버 사용 여부
PHP CONFIG - memcache.allow_failover
`memcache.allow_failover`는 Memcache 확장 모듈의 설정 중 하나입니다. Memcache 확장 모듈은 PHP에서 Memcache 서버와 통신하는 데 사용되는 확장 모듈입니다. 이 설정은 Memcache 서버가 연결되지 않았을 때 어떻게 행동할지 결정하는 데 사용됩니다.
# 기본값
`memcache.allow_failover`의 기본값은 `1`입니다. 이 설정이 `1`인 경우, Memcache 서버가 연결되지 않았을 때, PHP는 자동으로 다른 Memcache 서버와 연결을 시도합니다.
# 예제
#hostingforum.kr
php
$memcache = new Memcache;
$memcache->addServer('localhost', 11211, true); // true는 failover를 허용하도록 설정합니다.
# 설정 방법
`memcache.allow_failover` 설정을 변경하려면, PHP.ini 파일에서 `memcache.allow_failover` 설정을 변경하거나, PHP 코드에서 `Memcache` 객체를 생성할 때 `addServer` 메서드의 세 번째 인자를 `true`로 설정하면 됩니다.
# 예제 (PHP.ini 파일에서 설정)
#hostingforum.kr
ini
memcache.allow_failover = 1
# 예제 (PHP 코드에서 설정)
#hostingforum.kr
php
$memcache = new Memcache;
$memcache->addServer('localhost', 11211, true); // true는 failover를 허용하도록 설정합니다.
# 설정의 의미
`memcache.allow_failover` 설정이 `1`인 경우, Memcache 서버가 연결되지 않았을 때, PHP는 자동으로 다른 Memcache 서버와 연결을 시도합니다. 이 설정은 Memcache 서버가 여러 대가 있는 경우, 하나의 서버가 연결되지 않았을 때 다른 서버와 연결을 시도할 수 있도록 합니다.
# 예시 (Memcache 서버가 여러 대인 경우)
#hostingforum.kr
php
$memcache = new Memcache;
$memcache->addServer('localhost', 11211, true); // true는 failover를 허용하도록 설정합니다.
$memcache->addServer('localhost', 11212, true); // true는 failover를 허용하도록 설정합니다.
$memcache->addServer('localhost', 11213, true); // true는 failover를 허용하도록 설정합니다.
# 결론
`memcache.allow_failover` 설정은 Memcache 서버가 연결되지 않았을 때 어떻게 행동할지 결정하는 데 사용됩니다. 이 설정을 사용하면 Memcache 서버가 여러 대인 경우, 하나의 서버가 연결되지 않았을 때 다른 서버와 연결을 시도할 수 있도록 합니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.