这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ docker-push:

docker-clean:
docker rmi -f $(shell docker images --filter "dangling=true" -q --no-trunc)

build-docs:
mdbook build
224 changes: 3 additions & 221 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,225 +16,7 @@ Bayard makes easy for programmers to develop search applications with advanced f
- Command line interface is available


## Building Bayard
## Documents

```text
$ make build
```


## Starting in standalone mode (single node cluster)

Running node in standalone mode is easy. See following command:

```text
$ ./bin/bayard serve
```

### Indexing document

Indexing a document is as following:

```text
$ ./bin/bayard set 1 '{"text":"Tantivy is a full-text search engine library inspired by Apache Lucene and written in Rust."}'
$ ./bin/bayard set 2 '{"text":"Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java."}'
$ ./bin/bayard set 3 '{"text":"Bleve is a modern text indexing library for go."}'
$ ./bin/bayard set 4 '{"text":"Whoosh is a fast, pure Python search engine library."}'
$ ./bin/bayard set 5 '{"text":"Solr is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration and more."}'
$ ./bin/bayard set 6 '{"text":"Elasticsearch is a distributed, open source search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured."}'
$ ./bin/bayard set 7 '{"text":"Riot is Go Open Source, Distributed, Simple and efficient full text search engine."}'
$ ./bin/bayard set 8 '{"text":"Blast is a full text search and indexing server, written in Go, built on top of Bleve."}'
$ ./bin/bayard set 9 '{"text":"Toshi is meant to be a full-text search engine similar to Elasticsearch. Toshi strives to be to Elasticsearch what Tantivy is to Lucene."}'
$ ./bin/bayard set 10 '{"text":"Sonic is a fast, lightweight and schema-less search backend."}'
$ ./bin/bayard set 11 '{"text":"Bayard is a full text search and indexing server, written in Rust, built on top of Tantivy."}'
```

### Getting document

Getting a document is as following:

```text
$ ./bin/bayard get 11 | jq .
```

You can see the result in JSON format. The result of the above command is:

```json
{
"id": [
"11"
],
"text": [
"Bayard is a full text search and indexing server, written in Rust, built on top of Tantivy."
]
}
```

### Searching documents

Searching documents is as like following:

```
$ ./bin/bayard search text:"search engine" | jq .
```

You can see the result in JSON format. The result of the above command is:

```json
[
{
"id": [
"4"
],
"text": [
"Whoosh is a fast, pure Python search engine library."
]
},
{
"id": [
"7"
],
"text": [
"Riot is Go Open Source, Distributed, Simple and efficient full text search engine."
]
},
{
"id": [
"1"
],
"text": [
"Tantivy is a full-text search engine library inspired by Apache Lucene and written in Rust."
]
},
{
"id": [
"2"
],
"text": [
"Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java."
]
},
{
"id": [
"6"
],
"text": [
"Elasticsearch is a distributed, open source search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured."
]
},
{
"id": [
"9"
],
"text": [
"Toshi is meant to be a full-text search engine similar to Elasticsearch. Toshi strives to be to Elasticsearch what Tantivy is to Lucene."
]
},
{
"id": [
"10"
],
"text": [
"Sonic is a fast, lightweight and schema-less search backend."
]
},
{
"id": [
"11"
],
"text": [
"Bayard is a full text search and indexing server, written in Rust, built on top of Tantivy."
]
},
{
"id": [
"8"
],
"text": [
"Blast is a full text search and indexing server, written in Go, built on top of Bleve."
]
}
]
```

### Deleting document

```
$ ./bin/bayard delete 11
```


## Starting in cluster mode (3-node cluster)

Bayard can easily bring up a cluster. Running in standalone is not fault tolerant. If you need to improve fault tolerance, start two more nodes as follows:

```
$ ./bin/bayard serve \
--host=0.0.0.0 \
--port=5001 \
--id=1 \
--peers="1=0.0.0.0:5001" \
--data-directory=./data/1 \
--schema-file=./etc/schema.json \
--unique-key-field-name=id

$ ./bin/bayard serve \
--host=0.0.0.0 \
--port=5002 \
--id=2 \
--peers="1=0.0.0.0:5001,2=0.0.0.0:5002" \
--leader-id=1 \
--data-directory=./data/2 \
--schema-file=./etc/schema.json \
--unique-key-field-name=id

$ ./bin/bayard serve \
--host=0.0.0.0 \
--port=5003 \
--id=3 \
--peers="1=0.0.0.0:5001,2=0.0.0.0:5002,3=0.0.0.0:5003" \
--leader-id=1 \
--data-directory=./data/3 \
--schema-file=./etc/schema.json \
--unique-key-field-name=id
```

Above example shows each Bayard node running on the same host, so each node must listen on different ports. This would not be necessary if each node ran on a different host.
Recommend 3 or more odd number of nodes in the cluster. In failure scenarios, data loss is inevitable, so avoid deploying single nodes.

### Remove a node from a cluster

If one of the nodes in a cluster goes down due to a hardware failure and raft logs and metadata is lost, that node cannot join the cluster again.

```
$ ./bin/bayard leave \
--host=127.0.0.1 \
--port=5001 \
--id=3 \
--peers="1=0.0.0.0:5001,2=0.0.0.0:5002" \
--leader-id=1
```


## Bayard on Docker

### Pulling Docker container image from docker.io

You can pull the Docker container image already registered in docker.io like so:

```
$ docker pull bayardsearch/bayard:latest
```

Check the available version at the following URL:
https://hub.docker.com/r/bayardsearch/bayard/tags/

### Running Docker container

Running a Bayard on Docker like so:

```
$ docker run --rm --name bayard \
-p 5000:5000 \
bayardsearch/bayard:latest serve
```
The document is available at the following URL:
- [https://bayard-search.github.io/bayard/](https://bayard-search.github.io/bayard/)
10 changes: 10 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[book]
authors = ["Minoru Osuka"]
language = "en"
multilingual = false
src = "docs_src"
title = "Bayard"

[build]
build-dir = "docs"
create-missing = false
1 change: 1 addition & 0 deletions docs/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file makes sure that Github Pages doesn't process mdBook's output.
4 changes: 4 additions & 0 deletions docs/FontAwesome/css/font-awesome.css

Large diffs are not rendered by default.

Binary file added docs/FontAwesome/fonts/FontAwesome.ttf
Binary file not shown.
Binary file added docs/FontAwesome/fonts/fontawesome-webfont.eot
Binary file not shown.
Loading