TL : DR : AWS ElastiCache를 설정하고 SSH를 통해 EC2를 통해 연결했습니다.Codeigniter Memcached가 AWS Elasticache 인스턴스에 연결되지 않음
["localhost:11211"]
이유 : 나는 (동일한 EC2 인스턴스에서) 내 CodeIgniter의 응용 프로그램과 연결을 시도 할 때 연결을 시도하다는 실패하고 보여? 그것은해야하지 : 그래서 여기
["****.****.sae1.cache.amazonaws.com:11211"]
하면 배경이다 :
내가 CodeIgniter의 2.1.4을 사용하고 PHP 5.5와 내가 관리 응용 프로그램에서, 나는 저장할 Memcached를 사용하는 Elasticache 인스턴스의 일부 데이터.
내 응용 프로그램이 Elastic Beanstalk 환경에서 실행 중이며 Elasticache 인스턴스가 EB의 EC2 인스턴스와 동일한 보안 그룹에 있고 모든 TCP 연결을 열도록 규칙을 설정했습니다. 내가, 내 응용 프로그램 측면에서
#telnet ****.****.sae1.cache.amazonaws.com 11211
Trying xx.xx.xx.xx...
Connected to ****.****.sae1.cache.amazonaws.com.
:이 인스턴스에 SSH를 때
memcached support enabled
Version 2.2.0
libmemcached version 1.0.8
SASL support yes
Session support yes
igbinary support yes
json support yes
msgpack support no
내가 텔넷을 사용하여 Elasticache 인스턴스에 연결할 수 있습니다
Memcached가 우리가 실행은 phpinfo를 볼 수있는 활성화 구성한 응용 프로그램/설정/준비 같은/memcached.php :
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
$config = array(
'default' => array(
'host' => '****.****.sae1.cache.amazonaws.com',
'port' => 11211,
'weight' => 1
)
);
그리고 컨트롤러 :
public function memcached(){
$this->load->driver('cache');
if($this->cache->memcached->is_supported()){
$data = $this->cache->memcached->get('foo');
if (!$data){
echo 'cache miss!<br />';
$data = 'bar';
$this->cache->memcached->save('foo',$data, 60);
}
echo $data;
echo '<pre>';
var_dump($this->cache->memcached->cache_info());
echo '</pre>';
}
}
그리고 항상 출력 내가 Elasticache에 로컬 호스트에 연결을 시도하고 있지 않다라고, 왜? 출력은 다음과 같습니다.
cache miss!
bar
array(1) {
["localhost:11211"]=>
array(24) {
["pid"]=>
int(-1)
["uptime"]=>
int(0)
["threads"]=>
int(0)
["time"]=>
int(0)
["pointer_size"]=>
int(0)
["rusage_user_seconds"]=>
int(0)
["rusage_user_microseconds"]=>
int(0)
["rusage_system_seconds"]=>
int(0)
["rusage_system_microseconds"]=>
int(0)
["curr_items"]=>
int(0)
["total_items"]=>
int(0)
["limit_maxbytes"]=>
int(0)
["curr_connections"]=>
int(0)
["total_connections"]=>
int(0)
["connection_structures"]=>
int(0)
["bytes"]=>
int(0)
["cmd_get"]=>
int(0)
["cmd_set"]=>
int(0)
["get_hits"]=>
int(0)
["get_misses"]=>
int(0)
["evictions"]=>
int(0)
["bytes_read"]=>
int(0)
["bytes_written"]=>
int(0)
["version"]=>
string(0) ""
}
}
죄송합니다. 그러나 이것에 대한 어떤 생각이라도 고맙게 생각합니다.
건배.
은 적어도이 조건'경우 ($ this->의 Cache> memcached-에 진입 > is_supported()) {'... 아파치 서비스를 재시작 했습니까? ... 때로는 캐시를 사용하여 변경 사항을 반영하기 위해 아파치 서비스를 다시 시작해야합니다 :) – Hackerman
Thanks @Hackerman! 그냥 똑같은 출력을 시도했습니다. 건배 – grpaiva
어째서 귀하의 mmmm 라우팅을 관리하고 있습니까? 귀하의 사이트에 대한 모든 HTTP 요청을 캐시 서버로 리디렉션하는 방화벽 규칙이 있습니까? 그 부분 커버가 있습니까? – Hackerman