https://github.com/valeriansaliou/sonic

$ rustc --version
rustc 1.50.0-dev

ubantu环境

rocksdb 安装依赖

apt install build-essential

apt install clang

apt install libclang-dev

apt install libc6-dev

apt install g++

apt install llvm-dev

rust换源

$ cd .cargo/
tanpengfei3@bage:~/.cargo$ ls
bin config env registry
tanpengfei3@bage:~/.cargo$ cat config
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
#registry = "git://mirrors.ustc.edu.cn/crates.io-index"
# 如果所处的环境中不允许使用 git 协议,可以把上面的地址改为
registry = "https://mirrors.ustc.edu.cn/crates.io-index"

git clone https://github.com/dbtool/sonic.git

配置文件

$ cat /etc/sonic/config.cfg
# Sonic
# Fast, lightweight and schema-less search backend
# Configuration file
# Example: https://github.com/valeriansaliou/sonic/blob/master/config.cfg [server] log_level = "debug" [channel] inet = "127.0.0.1:1491"
tcp_timeout = 300 auth_password = "SecretPassword" [channel.search] query_limit_default = 10
query_limit_maximum = 100
query_alternates_try = 4 suggest_limit_default = 5
suggest_limit_maximum = 20 [store] [store.kv] path = "/opt/data/sonic/data/store/kv/" retain_word_objects = 1000 [store.kv.pool] inactive_after = 1800 [store.kv.database] flush_after = 900 compress = true
parallelism = 2
max_files = 100
max_compactions = 1
max_flushes = 1
write_buffer = 16384
write_ahead_log = true [store.fst] path = "/opt/data/sonic/data/store/fst/" [store.fst.pool] inactive_after = 300 [store.fst.graph] consolidate_after = 180 max_size = 2048
max_words = 250000

编辑

:/opt/wks/sonic$ cargo build
Downloaded ahash v0.4.6 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded cc v1.0.61 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded getrandom v0.1.15 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded hashbrown v0.9.1 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded proc-macro2 v1.0.24 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded regex v1.4.1 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded regex-syntax v0.6.20 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded rocksdb v0.15.0 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded serde v1.0.116 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded serde_derive v1.0.116 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded syn v1.0.44 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded toml v0.5.7 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded aho-corasick v0.7.14 (registry `https://mirrors.ustc.edu.cn/crates.io-index`)
Downloaded 13 crates (1.4 MB) in 4.19s
Compiling libc v0.2.79
Compiling cfg-if v0.1.10
Compiling memchr v2.3.3
Compiling proc-macro2 v1.0.24
Compiling version_check v0.9.2
Compiling bitflags v1.2.1
Compiling glob v0.3.0
Compiling unicode-xid v0.2.1
Compiling lazy_static v1.4.0
Compiling log v0.4.11
Compiling unicode-width v0.1.8
Compiling quick-error v1.2.3
Compiling regex-syntax v0.6.20
Compiling ansi_term v0.11.0
Compiling bindgen v0.54.0
Compiling vec_map v0.8.2
Compiling strsim v0.8.0
Compiling getrandom v0.1.15
Compiling termcolor v1.1.0
Compiling peeking_take_while v0.1.2
Compiling byteorder v1.3.4
Compiling lazycell v1.3.0
Compiling shlex v0.1.1
Compiling rustc-hash v1.1.0
Compiling fs_extra v1.2.0
Compiling autocfg v1.0.1
Compiling serde v1.0.116
Compiling ppv-lite86 v0.2.9
Compiling syn v1.0.44
Compiling utf8-ranges v1.0.4
Compiling ahash v0.3.8
Compiling nix v0.18.0
Compiling serde_derive v1.0.116
Compiling linked-hash-map v0.5.3
Compiling regex-syntax v0.3.9
Compiling ahash v0.4.6
Compiling radix v0.6.0
Compiling unicode-segmentation v1.6.0
Compiling thread_local v1.0.1
Compiling textwrap v0.11.0
Compiling humantime v1.3.0
Compiling nom v5.1.2
Compiling clang-sys v0.29.3
Compiling hashbrown v0.7.2
Compiling linked_hash_set v0.1.4
Compiling hashbrown v0.9.1
Compiling aho-corasick v0.7.14
Compiling quote v1.0.7
Compiling whatlang v0.10.0
Compiling regex v1.4.1
Compiling jobserver v0.1.21
Compiling atty v0.2.14
Compiling which v3.1.1
Compiling memmap v0.6.2
Compiling cc v1.0.61
Compiling clap v2.33.3
Compiling env_logger v0.7.1
Compiling cexpr v0.4.0
Compiling rand_core v0.5.1
Compiling fst v0.3.5
Compiling rand_chacha v0.2.2
Compiling fst-regex v0.2.2
Compiling fst-levenshtein v0.2.1
Compiling rand v0.7.3
Compiling libloading v0.5.2
Compiling jemalloc-sys v0.3.2
Compiling toml v0.5.7
Compiling twox-hash v1.5.0
Compiling librocksdb-sys v6.11.4
Compiling jemallocator v0.3.2
Compiling rocksdb v0.15.0
Compiling sonic-server v1.3.0 (/opt/wks/sonic)
Finished dev [unoptimized + debuginfo] target(s) in 5m 37s

以root用户运行

root@bage:/opt/wks/sonic/target/debug# ./sonic -c /etc/sonic/config.cfg

go客户端

https://github.com/expectedsh/go-sonic

package main

import (
"fmt"
"github.com/expectedsh/go-sonic/sonic"
) func main() { ingester, err := sonic.NewIngester("127.0.0.1", 1491, "SecretPassword")
if err != nil {
panic(err)
} // I will ignore all errors for demonstration purposes _ = ingester.BulkPush("movies", "general", 3, []sonic.IngestBulkRecord{
{"id:6ab56b4kk3", "Star wars"},
{"id:5hg67f8dg5", "Spider man"},
{"id:5hg67f8dg6", "super man"},
{"id:1m2n3b4vf6", "Batman"},
{"id:68d96h5h9d0", "This is another movie"},
}) search, err := sonic.NewSearch("127.0.0.1", 1491, "SecretPassword")
if err != nil {
panic(err)
} results, _ := search.Query("movies", "general", "man", 10, 0) fmt.Println(results)
}
$ go run sc.go
[id:5hg67f8dg6 id:5hg67f8dg5]

sonic 安装记录的更多相关文章

  1. 分布式监控系统Zabbix-3.0.3-完整安装记录(7)-使用percona监控MySQL

    前面已经介绍了分布式监控系统Zabbix-3.0.3-完整安装记录(2)-添加mysql监控,但是没有提供可以直接使用的Key,太过简陋,监控效果不佳.要想更加仔细的监控Mysql,业内同学们都会选择 ...

  2. 关于node.js和npm,cnpm的安装记录以及gulp自动构建工具的使用

    关于node.js和npm,cnpm的安装记录以及gulp自动构建工具的使用   工作环境:window下 在一切的最开始,安装node.js (中文站,更新比较慢http://nodejs.cn/) ...

  3. sourceinsight安装记录

    sourceinsight安装记录 此文章为本人使用sourceinsight一个星期之后的相关设置步骤记录和经验记录,以备以后查验,网上的相关资料都也较为完善,但是对于新手还是有一定困难的,所以在这 ...

  4. openerp安装记录及postgresql数据库问题解决

    ubuntu-14.04下openerp安装记录1.安装PostgreSQL 数据库    a.安装         sudo apt-get install postgresql    安装后ubu ...

  5. Matlab安装记录 - LED Control Activex控件安装

    Matlab安装记录-LED Control Activex控件安装 2013-12-01  22:06:36 最近在研究Matlab GUI技术,准备用于制作上位机程序:在Matlab GUI的技术 ...

  6. Arch Linux 安装记录

    Arch Linux 安装记录 基本上参考wiki上的新手指南,使用arch 2014.6.1 iso安装 设置网络 有线网络 Arch Linux 默认开启DHCP. 静态ip 首先关闭DHCP:s ...

  7. redis5.0.3单实例简单安装记录

    redis5.0.3单实例简单安装记录 日常需要测试使用,索性记录下来,免得临时又麻烦的找资料. yum -y install make gcc-c++ cmake bison-devel ncurs ...

  8. mysql5.7安装记录

    mysql安装记录 版本5.7 windows系统 一.缺少my.ini文件 [mysql]# 设置mysql客户端默认字符集default-character-set=utf8 [mysqld]#设 ...

  9. Liunx/RHEL6.5 Oracle11 安装记录

    1.创建用户组 groupadd oinstall #创建用户组oinstall groupadd dba #创建用户组dba useradd -g oinstall -g dba -m oracle ...

随机推荐

  1. Qt 使用大神插件快速创建树状导航栏

    前言 本博客仅仅记录自己的采坑过程以及帮助网友避坑,方便以后快速使用自定义控件,避免重复出错. 下载插件 大神 Github Qt 自定义控件项目地址:https://github.com/feiya ...

  2. Oracle Error while trying to retrieve text for error ORA-01804

    我在Linux上编译C++程序,有这个错误. 本机情况: Linux上Oracle的安装情况,服务器上有两个Client版本.我在Makefile中使用了高版本的动态库. 原因: 1.首先排查下 tn ...

  3. airflow 安装问题

    sasl Debian/Ubuntu: apt-get install python-dev libsasl2-dev gcc CentOS/RHEL: yum install gcc-c++ pyt ...

  4. Kafka面试题总结

    1.Kafka 都有哪些特点? 高吞吐量.低延迟:kafka每秒可以处理几十万条消息,它的延迟最低只有几毫秒,每个topic可以分多个partition, consumer group 对partit ...

  5. 菜鸡的Java笔记 第三十四 Annotation

    Annotation        多例模式特点:            1. 多例类可以有多个实例            2. 多例类必须自己创建自己的实例,并管理自己的实例,和向外界提供自己的实例 ...

  6. 菜鸡的Java笔记 图书馆

    图书大厦        开发要求            现在要求模拟一个图书大厦图书管理的程序结构,可以在图书大厦实现某一类图书的上架操作,下架操作,以及关键字模糊查询的操作            注 ...

  7. 【linux系统】命令学习(二)文件处理命令

    查看帮助 1.--help     例如:ls --help  会有中文 2.man       例如:man ls   都是英文 进入手册的界面 空格键:向下翻页 回车:一行一行翻页 B:向前翻页 ...

  8. vue + cesium开发(3) cesium1.87更新问题

    官方在2021年11月1号更新日志中记录了他们把zip.js升级到了2.3.12以适应webpack4中的关于import.meta不兼容的语法问题,但是经过实测,1.87版本依然没有解决这个问题,所 ...

  9. 第03章_基本的SELECT语句

    第03章_基本的SELECT语句 1. SQL概述 1.1 SQL背景知识 1946 年,世界上第一台电脑诞生,如今,借由这台电脑发展起来的互联网已经自成江湖.在这几十年里,无数的技术.产业在这片江湖 ...

  10. 【Vue.js】SPA

    SPA 2019-11-13  23:20:48  by冲冲 1.概念 (1)MPA(multi-page application) 特点:每一次页面跳转的时候,后台服务器都会返回一个新的html文档 ...