에서 이전 게시물, we saw the benefits of using index replicas over equivalent indexes.  Let’s say you are on Couchbase Server 4.x and have the following 3 equivalent indexes spread across 3 nodes; and with Couchbase 5.0 Beta available, you want to migrate these equivalent indexes to Index Replicas.

Note: If you want to use the same nodes to create the replicas, do make sure that they have the required memory and compute resources for the both the index replicas and equivalent indexes to coexist.

Step 1: Fire the following query with the num_replica parameter being 2, as we earlier had 3 copies of the index and want to maintain the same topology of indexes.

If you are bringing in a new set of 3 index nodes, then you might as well specify the ‘create index’ statement with the ‘nodes’ parameter set; for example:

Step 2: Once Step1 completes and all the index replicas are created and online(i.e, index build completed), drop the old 4.x equivalent indexes present.

Voila!! Your N1QL queries are all set to use the index replicas, and there was no application downtime during the process as well. If you had used ‘USE INDEX’ directive in your N1QL query, then the same needs to be updated with the new index name.

Equivalent indexes are still supported in Couchbase Server 5.0 and a mix of equivalent and replica indexes also works, i.e.,  N1QL queries would load balance between equivalent and replica indexes; but for efficient manageability, index replicas are recommended over equivalent indexes.

If you haven’t already, 여기를 클릭하세요 to download Couchbase Server 5.0 and play around with Index Replicas. 

작성자

게시자 벤캇 수브라마니안, 제품 관리자

벤캇은 제품 개발 및 제품 관리 업무를 담당하며 데이터/분석 플랫폼 및 제품을 개발해 왔습니다. 그의 경력의 상당 부분은 오라클에서 쌓은 것으로, 오라클 엔터프라이즈 관리자 팀의 엔지니어에서 오라클의 BI/분석 제품군의 제품 관리자로 전환했습니다. 과거에는 스타트업에서 머신러닝/NLP 제품 및 분산형 의사결정 시스템 개발을 도왔습니다. 그는 @venkasub에서 활동하고 있습니다.

댓글 하나

  1. 헤만트 마스타 5월 3, 2018에서 3:57 오후

    Nice blog Venkat. Can I increase the num_replica in 5.1 without recreating index ?

    1. 벤캇 수브라마니안, 제품 관리자 5월 3, 2018에서 8:07 오후

      Thanks Hemant. As of now, it is not possible. ALTER INDEX(introduced in 5.5) allows you to change index placements.

댓글 남기기