Commit f6518c9f authored by gejun's avatar gejun

Combine README and docs/getting_started.md

parent 6854081c
The opensource version of baidu-rpc
# baidu-rpc
# BUILD
A RPC framework used throughout Baidu, with more than 600,000 instances.
baidu-rpc prefers static linking if possible, so that deps don't have to be installed on every
machine running the code.
## Ubuntu/LinuxMint/WSL
### compile
1. install common deps: git g++ make libssl-dev
2. install gflags protobuf leveldb: libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev. If you need to statically link leveldb, install libsnappy-dev as well.
3. git clone this repo. cd into the repo and run
```
$ sh config_brpc.sh --headers=/usr/include --libs=/usr/lib
```
4. make
### run example
```
$ cd example/echo_c++
$ make
$ ./echo_server &
$ ./echo_client
```
### run examples with cpu/heap profilers
Install libgoogle-perftools-dev and re-run config_brpc.sh before compiling
### compile tests
Install gmock and gtest, use the gtest embedded in gmock and don't install libgtest-dev
```
$ sudo apt-get install google-mock
$ cd /usr/src
$ sudo cmake .
$ sudo make
$ sudo mv lib*.a gtest/lib*.a /usr/lib
$ sudo mv gtest/include/gtest /usr/include/
```
Rerun config_brpc.sh and run make in test/
## Baidu-internal
### compile
1. download `third-64/gflags@gflags_2-0-0-100_PD_BL` `third-64/protobuf@protobuf_2-4-1-1100_PD_BL` `third-64/leveldb@leveldb_1-0-0-0_PD_BL`
2. git clone this repo. cd into the repo and run
```
$ sh config_brpc.sh --headers=../../../third-64 --libs=../../../third-64
```
3. make
### run examples with cpu/heap profilers
download `third-64/tcmalloc@tcmalloc_1-7-0-200_PD_BL` and Rerun config_brpc.sh
# Supported deps
GCC: 4.8-7.1
Clang: 3.5-4.0
glibc: 2.12-2.25
protobuf: 2.4-3.2
gflags: 2.0-2.21
openssl: 0.97-1.1
tcmalloc: 1.7-2.5
Check out [Getting started](docs/getting_started.md) for more information.
......@@ -656,3 +656,11 @@ set_request_compress_type()设置request的压缩方式,默认不压缩。注
FATAL 04-07 20:00:03 7778 public/baidu-rpc/src/baidu/rpc/channel.cpp:123] Invalid address=`bns://group.user-persona.dumi.nj03'. You should use Init(naming_service_name, load_balancer_name, options) to access multiple servers.
访问bns要使用三个参数的Init,它第二个参数是load_balancer_name,而你这里用的是两个参数的Init,框架当你是访问单点,就会报这个错。
### Q: 两个产品线都使用protobuf,为什么不能互相访问
协议 !=protobuf。protobuf负责打包,协议负责定字段。打包格式相同不意味着字段可以互通。协议中可能会包含多个protobuf包,以及额外的长度、校验码、magic number等等。协议的互通是通过在RPC框架内转化为统一的编程接口完成的,而不是在protobuf层面。从广义上来说,protobuf也可以作为打包框架使用,生成其他序列化格式的包,像[idl<=>protobuf](http://wiki.baidu.com/pages/viewpage.action?pageId=144820547)就是通过protobuf生成了解析idl的代码。
### Q: 为什么C++ client/server 能够互相通信, 和其他语言的client/server 通信会报序列化失败的错误
检查一下C++ 版本是否开启了压缩 (Controller::set_compress_type), 目前 python/JAVA版的rpc框架还没有实现压缩,互相返回会出现问题。
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment