codis安装

linux企业运维——Codis:codis的安装及部署 1.Codis简介及Codis的核心组成 1.1redis的局限 在redis之中,它具备的特点是每台独立的redis服务器进行独立的服务,不会实现云的概念。 1.2codis简介 codis是一个分布式的redis解决方案,可通过动态扩充实现无限大的缓存数据库。 1.3codis的核心组成 Codis Server 替代了传统的redis server启动 Codis Proxy 代理多个codis server,实现HA机制 Codis D... 阅读详情

Codis 组成及架构图

访问流程:    client→ codis proxy→ zookeeper→ codis group (codis server master) 

其中 codis group (全部groups) 由 redis sentinel(哨兵) 监控进行主从切换.

其中 codis-HA  codis-admin 等均为辅助程序, 辅助监控各个节点和 管理后台.

环境依赖

  1. 下载基础组件安装包到数据盘  /data/ 并解压缩到  /data/service/ 

基础组件

版本

检测安装

下载地址

说明

Java环境 安装 1.8.0 java -version

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

chmod 755 jre-8u191-linux-x64.rpm

rpm   -i  jre-8u191-linux-x64.rpm

JRE 运行环境, 一般运行服务器建议部署JRE

JDK 开发环境

Golang环境 1.9.2 go version

https://golang.org/doc/install 国内被墙

https://www.golangtc.com/download 中文站下载

wget https://www.golangtc.com/static/go/1.9.2/go1.9.2.linux-amd64.tar.gz 国内中文站下载地址

tar -xzf go1.9.2.linux-amd64.tar.gz -C /usr/soft/

Codis的运行环境

Zookeeper 3.4.13

https://mirrors.cnnic.cn/apache/zookeeper/

wget https://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz

tar -xzf zookeeper-3.4.13.tar.gz -C /usr/soft/
ZK 集群
Codis下载地址 3.2.2

https://github.com/CodisLabs/codis/releases

wget https://github.com/CodisLabs/codis/releases/download/3.2.2/codis3.2.2-go1.9.2-linux.tar.gz

github 下载地址

tar -xzf codis3.2.2-go1.9.2-linux.tar.gz -C /usr/codis/
Codis Asset 套件包

其他参考文档

Codis 使用文档 https://github.com/CodisLabs/codis/blob/release3.1/doc/tutorial_zh.md
Codis集群搭建 https://www.cnblogs.com/Leo_wl/p/5687366.html

2. 安装各个组件

2.1  然后修改环境变量为 vim /etc/profile 在最后添加以下内容:

#实际安装go的地址

export GoROOT=/usr/soft/golang/go/bin

 #实际安装codis的地址

export CodisPATH=/usr/soft/codis/bin

  

JAVA_HOME=/home/app/jdk1.8.0_171/bin/java

CLASS_PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib

export ZOOKEEPER_HOME=/usr/local/zookeeper/server1

#将所有组件添加到path 中

export PATH=$PATH:$GoROOT/bin:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$CodisPATH/bin

然后执行 source /etc/profile    重新加载profile 配置文件
编辑一个文件来测试一下go是否正常使用了:

[root@codis-proxy ~]# vi hello.go 

        package main

    import "fmt"

    func main(){

        fmt.Printf("hello,world\n")

 }

[root@codis-proxy ~]# go run hello.go 

hello,world

Codis 解压缩后各个Asset 已经完成, nodis所有可执行文件

1、Codis Dashboard 配置

一  修改配置

vi /data/service/codis3/conf/dashboard.ini

##################################################

#                                                #

#                  Codis-Dashboard               #

#                                                #

##################################################

  

coordinator_name = "zookeeper" #外部存储类型,接受zookeeper/etcd

coordinator_addr = "192.168.6.0:2181,192.168.6.1:2181,192.168.6.2:2181/codis" #外部存储地址和端口

# Set Codis Product Name/Auth.

product_name = "codis-test" #集群名称

product_auth = "123456" #集群密码,最好设置跟redis密码一致,默认为空

# Set bind address for admin(rpc), tcp only.

admin_addr = "0.0.0.0:18080" #后台管理路径的地址和端口,如果设置"0.0.0.0"表示匹配当前的主机

#admin_addr = "0.0.0.0:18081"

#admin_addr = "192.168.6.3:18080"

#admin_addr = "192.168.6.3:18081"

# Set quorum value for sentinel, default is 2.

sentinel_quorum = 2 #

二 后台启动

此处使用 codis-dashboard 设置2个cpu, 加载dashboard.ini(文本文件可以设置其他后缀名,如toml) 启动服务

nohup /data/service/codis3/codis-dashboard --ncpu=2 --config=/data/service/codis3/conf/dashboard.ini --log=/data/service/codis3/logs/dashboard.log  --log-level=WARN &

三 关闭进程

lsof -i:18080 #检查进程是否启动

kill  xxxxx

注意点:

codis  dashboard 如果使用 kill-9 后  注册的 zk 不会对应删除注册信息, 导致 dashboard 启动不起来

由于 codis 使用 topom 管理配置,  kill -9 之后,  只需要删除 删除zk的/codis3/<产品名>/topom这个节点就可以了 


解决:
方法a:   绝对不使用kil -9,  对dashboard 进程直接kill
方法b:   zk 删除对应codis信息后, 再启动dashboard, 然后手工在后台一个个做配置

由于 codis 使用 topom 管理配置,  kill -9 之后,  只需要删除 删除zk的/codis3/<产品名>/topom这个节点就可以了 

方法c:   使用zk保持配置信息   1: 先将zk 的配置信息导出到文本, 2: 删除zk 的codis3 节点,  3:启动 dashboard 使得在zk上重建 codis3 节点  4: 找到dashboard进程直接kill掉 (千万不要kill -9)  5: 导入codis3节点的配置,  6 重新启动dashboard

zk 命令行操作指南 :    https://www.cnblogs.com/sherrykid/p/5813148.html

方法d:  推荐! 使用本地文件保持配置信息   1:  修改本地file 的codis3 节点名字为 codis3a,  3:启动 dashboard 使得在zk上重建 codis3 节点  4: 找到dashboard进程直接kill掉 (千万不要kill -9)  5: 导入codis3节点的配置,  6 重新启动dashboard

四 查看日志

利用Docker安装运行Codis 最近打算对缓存中间进行专题性学习,之前使用过Redis Sentinal,后来认识到Codis,对Codis产生感兴趣,于是便有了下面的安装运行总结。 什么是Codis目前基于Redis集群的方案有三种,第一种是Redis Sentinal,第二种是Redis Cluster,第三种是豌豆荚的Codis。 Redis Sentinal搭建简单,不过受Redis容量限制,普通应用个人觉得已经足够了; 阅读详情

相关推荐

从零构建:如何在VSCode中为HBuilderX迁移的UniApp项目搭建TypeScript支持环境

本文详细指导如何将HBuilderX中的UniApp项目迁移至VSCode并搭建TypeScript支持环境。通过pnpm包管理器初始化项目、配置tsconfig.json和vite.config.ts文件,实现工程化迁移与TypeScript深度集成,提升开发效率和代码质量。

book8的博客 1051

AI大模型API中转站选型指南:12项关键指标与实战评估

随着AI大模型技术的快速迭代,企业面临着一个核心挑战:如何在基础模型频繁更新的背景下,为业务系统选择稳定可靠的API中转服务?本文基于真实生产环境测试数据,从12个关键维度系统评估主流API中转站平台,帮助技术团队在模型快速演进的生态中做出科学选型决策。 1. API中转站的核心价值与业务场景 1.1 什么是API中转站 API中转站(API Gateway/Aggregator)是连接业务系统与多个大模型厂商的中间层服务。它通过统一的接口封装了不同厂商的API协议差异,为企业提供标准化的模型调用能力。在实

weixin_29056101的博客 447

三、STM32F103ZET6最小系统

stm32最小系统除去主控CPU外,需要包含,电源电路,复位电路,BOOT电路,时钟电路(因为stm32有内置时钟,对时钟要求不高的话,可以不要)。NRST引脚其实芯片已经用一个约40K的电阻上拉了,所以理论上来说是不需要再外接上拉电阻的,但我看大家都是有外接上拉的,心里没有底,不管这么多,先预留着。吃过亏,特意查看了芯片手册资料,下图是官方建议的供电方案,图片来自stm32f103zet6数据手册。首先明白目标,单纯的学习软件知识并不是我希望的,我还希望会硬件设计,这样后面才能摆脱开发板。

sevendecsdn的博客 6457

信创改造实战:SpringBoot项目迁移到宝兰德BES 9.5.5的完整避坑指南(附依赖与web.xml配置)

本文详细介绍了将SpringBoot项目迁移到宝兰德BES 9.5.5的完整流程,包括依赖改造、web.xml配置降级等关键步骤。通过实战案例和避坑指南,帮助开发者高效完成国产中间件适配,确保项目平稳运行。特别针对Tomcat依赖排除和BES适配器选择提供了专业建议。

weixin_30689307的博客 742

基于fme和python-docx第三方库批量更新不动产调查表

最近应朋友需要批量更新在不动产成果中提交的各种word报表中的指定数据,根据初步的了解,我做了一个基于fme软件和python-docx第三方库进行一个批量的更新方案。

weixin_43229258的博客 1240

大数据与宠物:健康监测数据分析

随着全球宠物市场规模的快速增长(2023年全球宠物产业规模已达3500亿美元),宠物健康管理需求呈现指数级上升。传统宠物医疗依赖定期体检和症状观察,存在滞后性和主观性缺陷。本文聚焦如何通过物联网(IoT)设备采集宠物生理数据(体温、心率、活动量等),利用大数据分析技术构建实时健康监测系统,实现宠物健康状态的动态评估、异常预警和疾病预测。研究范围涵盖数据采集技术、数据预处理方法、机器学习模型构建及实际应用场景落地。背景介绍:明确研究目的、目标读者及核心术语核心概念与联系。

2502_91592937的博客 1068

深入浅出AXI协议(2)——通道及信号

本文我们继续AXI协议的学习,我们将讨论5个通道的具体内容和相对应的信号。这一部分的内容现在对于大家来说可能很难理解,但是没有关系,随着学习的深入,我们会逐步讲解这里面的所有现在,现在只需要把它们当作一个可以查阅的手册,快速阅读有一个基本的印象即可。

apple_53311083的博客 1800

雷达工程师面试题目

详细描述项目背景、目标、你的具体职责和贡献,分析在项目实施过程中遇到的主要技术难题及解决方案,总结项目取得的成果和经验教训。

道亦无名 739

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: k8s相关
下一篇: 各消息队列对比
西游却冻醒
博客等级 码龄11年 47粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值