GithubHelp home page GithubHelp logo

dev-ozan / go-dcp-couchbase Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trendyol/go-dcp-couchbase

1.0 0.0 0.0 877 KB

The Go implementation of the Couchbase to Couchbase with DCP.

License: MIT License

Go 94.60% Makefile 1.91% Dockerfile 3.48%

go-dcp-couchbase's Introduction

Go Dcp Couchbase

Go Reference Go Report Card

Go Dcp Couchbase streams documents from Couchbase Database Change Protocol (DCP) and writes to Couchbase bucket in near real-time.

Features

  • Less resource usage and higher throughput.
  • Update multiple documents for a DCP event(see Example).
  • Handling different DCP events such as expiration, deletion and mutation(see Example).
  • Managing batch configurations such as maximum batch size, batch bytes, batch ticker durations.
  • Scale up and down by custom membership algorithms(Couchbase, KubernetesHa, Kubernetes StatefulSet or Static, see examples).
  • Easily manageable configurations.

Concepts

General Concept general

Merge at target bucket merge-buckets

Example

Struct Config

package main

import (
	"github.com/Trendyol/go-dcp-couchbase"
	"time"

	"github.com/Trendyol/go-dcp-couchbase/config"
	dcpConfig "github.com/Trendyol/go-dcp/config"
	"github.com/Trendyol/go-dcp/logger"
)

func main() {
	c, err := dcpcouchbase.NewConnector(&config.Config{
		Dcp: dcpConfig.Dcp{
			Hosts:      []string{"localhost:8091"},
			Username:   "user",
			Password:   "password",
			BucketName: "dcp-test",
			Dcp: dcpConfig.ExternalDcp{
				Group: dcpConfig.DCPGroup{
					Name: "groupName",
					Membership: dcpConfig.DCPGroupMembership{
						RebalanceDelay: 3 * time.Second,
					},
				},
			},
			Metadata: dcpConfig.Metadata{
				Config: map[string]string{
					"bucket":     "dcp-test-meta",
					"scope":      "_default",
					"collection": "_default",
				},
				Type: "couchbase",
			},
			Debug: true,
		},
		Couchbase: config.Couchbase{
			Hosts:          []string{"localhost:8091"},
			Username:       "user",
			Password:       "password",
			BucketName:     "dcp-test-backup",
			BatchSizeLimit: 10,
			RequestTimeout: 10 * time.Second,
		},
	}, dcpcouchbase.DefaultMapper, logger.Log, logger.ErrorLog)
	if err != nil {
		panic(err)
	}

	defer c.Close()
	c.Start()
}

Configuration

Dcp Configuration

Check out on go-dcp

Couchbase Specific Configuration

Variable Type Required Default Description
Hosts []string yes Couchbase connection urls
BucketName string yes Defines Couchbase bucket name
ScopeName string no _default Defines Couchbase scope name
CollectionName string no _default Defines Couchbase collection name
BatchSizeLimit int no 1000 Maximum message count for batch, if exceed flush will be triggered.
BatchTickerDuration time.Duration no 10s Batch is being flushed automatically at specific time intervals for long waiting messages in batch.
BatchByteSizeLimit int no 10485760 Maximum size(byte) for batch, if exceed flush will be triggered.
RequestTimeout int no 3s Maximum request waiting time. Value type milliseconds.

Exposed metrics

For DCP related metrics see also.

Contributing

Go Dcp Couchbase is always open for direct contributions. For more information please check our Contribution Guideline document.

License

Released under the MIT License.

go-dcp-couchbase's People

Contributors

erayarslan avatar mhmtszr avatar tahsinyuksel avatar

Stargazers

Ozan GENÇ avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.