문제

Predis claim to have Client-side sharding (support for consistent hashing of keys). http://github.com/nrk/predis

I can do sharding using connect to an array of profiles (nodes) but it isn't consistent hashing. When I add another node to the pool, some of the keys can't be found. Anyone has any experience on this?

Using php 5.2 (and redis's php 5.2 version).

도움이 되었습니까?

해결책

도메인 \ SN_SPAPPPROD 계정의 사용 권한 문제처럼 보입니다.필요한 권한이있는 SQL 로그인이 있습니까?다중 서버 팜이있는 경우 모든 서버에 별칭이 있습니까?

사용자가 액세스 권한이 있는지 확인하는 좋은 트릭은 이 기사는 어떻게 해야할지에 대한 .해당 테스트가 오류가 없으면 SQL Server에 대한 연결이 괜찮습니다 - 테스트를 실행할 때 별칭 이름 Server2를 사용해야합니다.

테스트가 오류를 반환하면 별칭이 서버에서 올바르게 구성되지 않았을 것입니다.

구성 마법사를 실행하기 위해 계정에 필요한 권한이 없을 수도 있습니다.이 기사 .

다른 팁

The solution is to use virtual sharding. I don't know Predis framework works but I predict that it uses some kind of array - you probably fill it with information about each shard at start-up.

Assume that you will have maximum of 10 shards (this number should be unlikely to be reached). Then, create sharding array that points to only 3 real servers. In the future when you will add new nodes, you will migrate related data to new shard and change mapping. This approach preserves form changing hash function.

Initial mapping:

0 => 0 //node #0
1 => 0
2 => 0
3 => 1 //node #1
4 => 1
5 => 1
6 => 2 //node #2
7 => 2
8 => 2
9 => 2

When you adds new node you only change mapping:

0 => 0
1 => 0
2 => 3 // new node #3
3 => 1
4 => 1
5 => 3 // new node #3
7 => 2
8 => 2
9 => 3 // new node #3

so you have to move data with h(x) = 9 or 5 or 2 to node #3.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top