Code Monkey home page Code Monkey logo

pegasus-go-client's Introduction

pegasus-go-client

codecov

Go Report Card

PkgGoDev

This is the official go client for Apache Pegasus.

Requirement

Go1.12+.

Logging

By default pegasus-go-client logs to "./pegasus.log" on where your application runs. You can customize the logging rules as follows:

    // customize where the pegasus-go-client's logs reside.
    pegalog.SetLogger(pegalog.NewLogrusLogger(&pegalog.LogrusConfig{
        // rotation rules
        MaxSize:    500, // megabytes
        MaxAge:     5,   // days
        MaxBackups: 100,
        // log files location
        Filename:   "/home/work/myapp/log/pegasus.log",
    }))

To print the logs on screen:

pegalog.SetLogger(pegalog.StderrLogger)

We highly recommend you to enable client logging for debugging purpose. If you want support for other log destinations or log formats, please submit an issue for that.

Example

    import (
        "context"

        "github.com/XiaoMi/pegasus-go-client/pegasus"
    )

    cfg := Config{
        MetaServers: []string{"0.0.0.0:34601", "0.0.0.0:34602", "0.0.0.0:34603"},
    }

    client := NewClient(cfg)
    defer client.Close()

    tb, err := client.OpenTable(context.Background(), "temp")
    err = tb.Set(context.Background(), []byte("h1"), []byte("s1"), []byte("v1"))

For more examples please refer to example/.

TroubleShooting

Before using pegasus-go-client, it's recommended to configure GOBACKTRACE so as to generate coredump while program unexpectedly corrupts.

ulimit -c unlimited
export GOBACTRACE=crash

pegasus-go-client's People

Contributors

hycdong avatar foreverneverer avatar mentoswang avatar smityz avatar catror avatar zhangyifan27 avatar levy5307 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.