首页 文章 精选 留言 我的

精选列表

搜索[一键部署],共10000篇文章
优秀的个人博客,低调大师

Springboot企业级部署解决方案

使用springboot的童鞋们,有没曾经想把项目打包成 bin/conf/libs/logs 等这样的结构然后直接运行的,但是找了很多办法都不够完美(因为G是个完美主义 ) 好了直接来看解决方案: 1、修改执行打包的子工程的pom.xml文件(加入两个插件): <build> <finalName>app</finalName> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>script/**</exclude> </excludes> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <skip>true</skip> <archive> <manifest> <mainClass>com.xxx.bbb.MyMainClass</mainClass> <addClasspath>true</addClasspath> </manifest> <manifestEntries> <Class-Path>./</Class-Path> <Built-By>Wangl.sir</Built-By> <Built-Mail-By>983708408@qq.com</Built-Mail-By> <Bundle-Name>Project Description</Bundle-Name> <Implementation-Vendor></Implementation-Vendor> <Implementation-URL>http://www.xxx.com/wiki</Implementation-URL> </manifestEntries> </archive> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <finalName>app-${project.version}-bin</finalName> <!-- not append assembly id in release file name --> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>src/main/assemble/package.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 2、新增assemble配置文件(保存至src/main/assemble/package.xml): <assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.0.0.xsd"> <id>jar-with-dependencies</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> <fileSets> <fileSet> <!-- src/main/resources/script目录保存的如:app_ctrl.sh、app_start.sh、app_stop.sh等脚本,maven-assemble会将此目录下的.sh文件复制到最后生成的bin目录下 --> <directory>src/main/resources/script</directory> <outputDirectory>bin</outputDirectory> <includes> <include>*.*</include> </includes> </fileSet> <fileSet> <directory>src/main/resources</directory> <outputDirectory>conf</outputDirectory> <includes> <include>*.*</include> </includes> </fileSet> <fileSet> <directory>target</directory> <outputDirectory>libs</outputDirectory> <includes> <include>*.jar</include> </includes> </fileSet> <fileSet> <directory>src/main/resources</directory> <outputDirectory>logs</outputDirectory> <excludes> <exclude>*.*</exclude> <exclude>script/**</exclude> </excludes> </fileSet> </fileSets> <dependencySets> <dependencySet> <outputDirectory>libs</outputDirectory> <scope>runtime</scope> <excludes> <exclude>${groupId}:${artifactId}</exclude> </excludes> </dependencySet> </dependencySets> </assembly> 3、最后就只需执行 mvn clean install -DskipTests 等待maven执行完成,在target目录下会出现app-{project.version}-bin.zip

优秀的个人博客,低调大师

Linux下RAID磁盘阵列部署详解

磁盘阵列 RAID RAID:廉价磁盘冗余阵列(Redundant Array of Independent Disks) 作 用:容错、提升读写速率 RAID类型 个数 利用率 优缺点 ------------------------------------- RAID0 条带集 2+ 100% 读写速率最快,不容错 RAID1 镜像集 2 50% 读写速率一般,容错 RAID5 带奇偶校验条带集 3+ (n-1)/n 读写速率快,容错,允许坏一块 RAID6 带奇偶校验条带集双校验dp 4+ (n-2)/n 读写快,容错,允许坏两块 RAID01 RAID10 RAID1的安全+RAID0的高速 4 50% 读写速率快,容错 RAID50 RAID5的安全+RAID0的高速 6 (n-2)/n 读写速率快,容错 RAID60 RAID6的安全+RAID0的高速 8 (n-4)/n 读写速率快,容错 ------------------------------------- 一、不同场景RAID的使用 RAID 实现方式 硬RAID: 需要RAID卡,有自己的CPU,处理速度快,有电池和无电池 软RAID: 通过操作系统实现,比如Windows、Linux 二、RAID5 (3块硬盘) + 热备(1块硬盘) 1. 准备4块硬盘 [root@maiya ~]# ll /dev/sd* brw-rw---- 1 root disk 8, 48 Jan 13 16:07 /dev/sdd brw-rw---- 1 root disk 8, 64 Jan 13 16:07 /dev/sde brw-rw---- 1 root disk 8, 80 Jan 13 16:07 /dev/sdf brw-rw---- 1 root disk 8, 80 Jan 13 16:07 /dev/sdg 2. 创建RAID [root@maiya ~]# yum -y install mdadm //确保mdadm命令可用 [root@maiya ~]# mdadm -C /dev/md0 -l5 -n3 -x1 /dev/sd{d,e,f,g} mdadm: array /dev/md0 started. -C 创建RAID /dev/md0 第一个RAID设备 -l5 RAID5 -n RAID成员的数量 -x 热备磁盘的数量 3. 格式化,挂载 [root@maiya ~]# mkfs.xfs /dev/md0 [root@maiya ~]# mkdir /mnt/raid5 [root@maiya ~]# mount /dev/md0 /mnt/raid5 [root@maiya ~]# cp -rf /etc /mnt/raid5/etc1 4. 查看RAID信息 [root@maiya ~]# mdadm -D /dev/md0 //-D 查看详细信息 /dev/md0: Version : 1.2 Creation Time : Mon Jan 13 16:28:47 2014 Raid Level : raid5 Array Size : 2095104 (2046.34 MiB 2145.39 MB) Used Dev Size : 1047552 (1023.17 MiB 1072.69 MB) Raid Devices : 3 Total Devices : 4 Persistence : Superblock is persistent Update Time : Mon Jan 13 16:34:51 2014 State : clean Active Devices : 3 Working Devices : 4 Failed Devices : 0 Spare Devices : 1 Layout : left-symmetric Chunk Size : 512K Number Major Minor RaidDevice State 0 8 48 0 active sync /dev/sdd 1 8 64 1 active sync /dev/sde 4 8 80 2 active sync /dev/sdf 3 8 96 - spare /dev/sdg 5. 模拟一块硬盘损坏,并移除 终端一: [root@maiya ~]# watch -n 0.5 'mdadm -D /dev/md0 | tail' //watch持续查看 终端二: [root@maiya ~]# mdadm /dev/md0 -f /dev/sde -r /dev/sde //模拟坏了并移除 -f --fail -r --remove 6. 设置RAID开机生效 [root@maiya ~]# mdadm -D -s ARRAY /dev/md0 metadata=1.2 name=sxl1.com:0 UUID=c6761621:8878498f:f5be209e [root@maiya ~]# mdadm -D -s > /etc/mdadm.conf mdadm选项: -s --scan -S --stop -D --detail -C --create -f --fail -r --remove -n --raid-devices=3 -x --spare-devices=1 -l --level=5 参考: Update Time : Mon Aug 4 22:47:47 2014 State : clean, degraded, recovering Active Devices : 2 Working Devices : 3 Failed Devices : 0 Spare Devices : 1 Layout : left-symmetric Chunk Size : 512K Rebuild Status : 3% complete Name : localhost.localdomain:0 (local to host localhost.localdomain) UUID : 3df9624c:138a5b3e:2f557132:59a43d04 Events : 41 Number Major Minor RaidDevice State 0 252 16 0 active sync /dev/vdb 3 252 64 1 spare rebuilding /dev/vde 4 252 48 2 active sync /dev/vdd

优秀的个人博客,低调大师

(二)Hyperledger Fabric 1.1安装部署-Fabric Samples

Hyperledger Fabric Samples是官方推荐的First Network,对于熟悉fabric和测试基础环境很有好处。 Fabric Samples源码下载: 使用git下载源码,进入到go安装目录(可以使用命令echo $GOPATH查看go安装目录)。 git clone -b master https://github.com/hyperledger/fabric-samples.git 下载完成后进入到fabric-samples目录 cd fabric-samples 使用git tag命令查看版本列表,根据个人需要将源码切换到对应的版本,本次使用的是1.1版。 git checkout -b v1.1.0 下载二进制文件: 二进制文件官方给出两种方式 curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0(这个方式需要FQ) 或者直接访问下面的网址,访问二进制文件 https://github.com/hyperledger/fabric/blob/master/scripts/bootstrap.sh 也可以新建bootstrap.sh文件,拷贝下面的脚本并执行。 #!/bin/bash # # Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # # if version not passed in, default to latest released version export VERSION=${1:-1.1.0} # if ca version not passed in, default to latest released version export CA_VERSION=${2:-$VERSION} # current version of thirdparty images (couchdb, kafka and zookeeper) released export THIRDPARTY_IMAGE_VERSION=0.4.6 export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') #Set MARCH variable i.e ppc64le,s390x,x86_64,i386 MARCH=`uname -m` dockerFabricPull() { local FABRIC_TAG=$1 for IMAGES in peer orderer ccenv javaenv tools; do echo "==> FABRIC IMAGE: $IMAGES" echo docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES done } dockerThirdPartyImagesPull() { local THIRDPARTY_TAG=$1 for IMAGES in couchdb kafka zookeeper; do echo "==> THIRDPARTY DOCKER IMAGE: $IMAGES" echo docker pull hyperledger/fabric-$IMAGES:$THIRDPARTY_TAG docker tag hyperledger/fabric-$IMAGES:$THIRDPARTY_TAG hyperledger/fabric-$IMAGES done } dockerCaPull() { local CA_TAG=$1 echo "==> FABRIC CA IMAGE" echo docker pull hyperledger/fabric-ca:$CA_TAG docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca } : ${CA_TAG:="$MARCH-$CA_VERSION"} : ${FABRIC_TAG:="$MARCH-$VERSION"} : ${THIRDPARTY_TAG:="$MARCH-$THIRDPARTY_IMAGE_VERSION"} echo "===> Downloading platform specific fabric binaries" curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/hyperledger-fabric-${ARCH}-${VERSION}.tar.gz | tar xz echo "===> Downloading platform specific fabric-ca-client binary" curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/${ARCH}-${VERSION}/hyperledger-fabric-ca-${ARCH}-${VERSION}.tar.gz | tar xz if [ $? != 0 ]; then echo echo "------> $VERSION fabric-ca-client binary is not available to download (Avaialble from 1.1.0-rc1) <----" echo fi which docker >& /dev/null NODOCKER=$? if [ "${NODOCKER}" == 0 ]; then echo "===> Pulling fabric Images" dockerFabricPull ${FABRIC_TAG} echo "===> Pulling fabric ca Image" dockerCaPull ${CA_TAG} echo "===> Pulling thirdparty docker images" dockerThirdPartyImagesPull ${THIRDPARTY_TAG} echo echo "===> List out hyperledger docker images" docker images | grep hyperledger* else echo "=========================================================" echo "Docker not installed, bypassing download of Fabric images" echo "=========================================================" fi 这个脚本将下载网络所需的特定二进制文件和镜像。执行成功后会生成bin和config。 bin文件: config文件: 拉取的镜像: 可以通过docker images命令查看 上述工作完成以后就可以进行Fabric Samples测试了。

优秀的个人博客,低调大师

kylin_学习_01_kylin安装部署

一、环境准备 根据官方文档,kylin是需要运行在hadoop环境下的,如下图: 1.hadoop环境搭建 参考:hadoop_学习_02_Hadoop环境搭建(单机) 2.hbase环境搭建 参考:hbase_学习_01_HBase环境搭建(单机) 3.hive环境搭建 参考:hive_学习_01_hive环境搭建(单机) 二、kylin下载与解压 1.下载地址 前往官方http://kylin.apache.org/download 可发现提供了一个镜像下载地址,如下: http://mirrors.shu.edu.cn/apache/kylin/apache-kylin-2.3.0/apache-kylin-2.3.0-hbase1x-bin.tar.gz 2.下载 使用命令进行下载 wget http://mirrors.shu.edu.cn/apache/kylin/apache-kylin-2.3.0/apache-kylin-2.3.0-hbase1x-bin.tar.gz 或者先在本地下载,然后上传服务器 3.解压 tar -zxvf apache-kylin-2.3.0-hbase1x-bin.tar.gz 三、kylin配置 1.配置环境变量 (1)编辑 profile 文件 vim /etc/profile (2)设置 KYLIN_HOME ,并将其添加到path中。并修改CATALINA_HOME 为 kylin 下的 tomcat # 1. java export JAVA_HOME=/usr/java/jdk1.7.0_80 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # 2. Tomcat #export CATALINA_HOME=/developer/apache-tomcat-7.0.73 #export CATALINA_HOME=/developer/saiku-server/tomcat export CATALINA_HOME=/developer/apache-kylin-2.3.0-bin/tomcat # 3. Maven export MAVEN_HOME=/developer/apache-maven-3.0.5 # 4. hadoop export HADOOP_HOME=/developer/hadoop-2.6.0 # 5. hbase export HBASE_HOME=/developer/hbase-1.2.0 # 6. hive export HIVE_HOME=/developer/apache-hive-1.1.0-bin export HIVE_CONF_DIR=${HIVE_HOME}/conf export HCAT_HOME=$HIVE_HOME/hcatalog # 7. kylin export KYLIN_HOME=/developer/apache-kylin-2.3.0-bin export hive_dependency=$HIVE_HOME/conf:$HIVE_HOME/lib/*:$HCAT_HOME/share/hcatalog/hive-hcatalog-core-1.1.0.jar #Path # 1. big data export PATH=$KYLIN_HOME/bin:$PATH export PATH=$HIVE_HOME/bin:$HBASE_HOME/bin:$HADOOP_HOME/bin:$PATH export PATH=$MAVEN_HOME/bin:$CATALINA_HOME/bin:$JAVA_HOME/bin:$PATH export LC_ALL=en_US.UTF-8 2.配置kylin.sh 在文件开始的地方,添加如下配置: export KYLIN_HOME=/developer/apache-kylin-2.3.0-bin export HBASE_CLASSPATH_PREFIX=$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar:$CATALINA_HOME/lib/*:$hive_dependency:$HBASE_CLASSPATH_PREFIX 四、启动kylin 1.确保 hadoop、hbase已经启动 (1)启动hadoop 进入hadoop 的 sbin 目录,执行 ./start-all.sh (2) 启动 hbase 进入hbase的 bin 目录,执行 ./start-hbase.sh 2.启动 kylin 进入 kylin 的 bin 目录,执行 ./kylin.sh start 即可启动kylin 3.访问kylin管理界面 启动kylin之后,浏览器访问:http://your_hostname:7070/kylin。输入用户名 ADMIN 、密码 KYLIN ,即可登录 例如: 192.168.1.102:7070/kylin 五、配置hive数据源 1.配置数据源 (1)依次选择 Model -> Data Source -> Load Hive Table (2)输入 hive 中数据库的表名格式为: 数据库名.数据表名 如:db_hiveTest.student ,然后点击Sync即可。 添加成功后,效果如下图: 五、参考资料 1.官方安装向导 : Installation Guide(http://kylin.apache.org/cn/docs23/install/index.html) 2.HDP下载地址: https://zh.hortonworks.com/downloads/

优秀的个人博客,低调大师

Redis 集群部署及踩过的坑

本文目标 要在单台机器上搭建Redis集群,方式是通过不同的TCP端口启动多个实例,然后组成集群,同时记录在搭建过程中踩过的坑。 安装准备 centos版本:6.7 redis版本:3.2.3 安装方式:源码安装 服务器:1台 操作步骤 此处默认已安装好单台redis 1、启动Redis多个实例 我们在Redis安装目录下创建目录cluster,并编写7000.conf~7005.conf 6个配置文件,这6个配置文件用来启动6个实例,后面将使用这6个实例组成集群。 以7000.conf为例,配置文件需要填写如下几项: port7000//端口7000,7001,7002,7003,7004,7005 bind192.168.186.91//默认ip为127.0.0.1 需要改为其他节点机器可访问的ip 否则创建集群时无法访问对应的端口,无法创建集群 daemonizeyes//redis后台运行 pidfile./redis_7000.pid//pidfile文件对应7000,7001,7002,7003,7004,7005 cluster-enabledyes//开启集群把注释#去掉 cluster-config-filenodes_7000.conf//集群的配置配置文件首次启动自动生成 7000,7001,7002,7003,7004,7005 cluster-node-timeout15000//请求超时默认15秒,可自行设置 appendonlyyes//aof日志开启有需要就开启,它会每次写操作都记录一条日志 分别启动6个实例 redis-serverredis_cluster/7000/redis.conf redis-serverredis_cluster/7001/redis.conf redis-serverredis_cluster/7002/redis.conf redis-serverredis_cluster/7003/redis.conf redis-serverredis_cluster/7004/redis.conf redis-serverredis_cluster/7005/redis.conf 启动成功后,看一下进程 # ps -ef | grep redis | grep cluster idata1571122329018:40pts/1000:00:00./bin/redis-server192.168.186.91:7000[cluster] idata1574022329018:40pts/1000:00:00./bin/redis-server192.168.186.91:7001[cluster] idata1581022329018:40pts/1000:00:00./bin/redis-server192.168.186.91:7002[cluster] idata1702322329018:42pts/1000:00:00./bin/redis-server192.168.186.91:7003[cluster] idata1703022329018:42pts/1000:00:00./bin/redis-server192.168.186.91:7004[cluster] idata1703522329018:42pts/1000:00:00./bin/redis-server192.168.186.91:7005[cluster] 至此,ip=192.168.186.91机器上创建了6个实例,端口号为port=7000~7005。 2、安装ruby 1)yum安装ruby和依赖的包。 [root@itfirstredis_cluster]# yum -y install ruby ruby-devel rubygems rpm-build 2)使用gem这个命令来安装redis接口 [root@itfirstredis_cluster]# gem install redis ERROR:Error installingredis: redis requires Rubyversion>=2.2.2. 这一步骤中出现了bug,度娘告诉我是Ruby版本太低,需要升级版本。 3)升级Ruby的版本 安装rvm,我不知道这是个什么东西,但是感觉像是Ruby的一个包管理器。 [root@itfirstredis_cluster]# curl -L get.rvm.io | bash -s stable %Total%Received%XferdAverage Speed TimeTime TimeCurrent DloadUpload Total SpentLeftSpeed 1002409010024090001091900:00:020:00:02--:--:--91242 Downloadinghttps://github.com/rvm/rvm/archive/1.29.3.tar.gz Downloadinghttps://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc gpg:于2017年09月11日星期一04时59分21秒CST创建的签名,使用RSA,钥匙号BF04FF17 gpg:无法检查签名:Nopublickey Warning,RVM1.26.0introducessignedreleasesandautomated check of signatures when GPG softwarefound.Assuming you trust Michal Papis import the mpapispublickey(downloading thesignatures). GPG signature verification failedfor'/usr/local/rvm/archives/rvm-1.29.3.tgz'-'https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc'!Trytoinstall GPG v2andthenfetch thepublickey: gpg2--recv-keys409B6B1796C275462A1703113804BB82D39DC0E3 orifitfails: commandcurl-sSLhttps://rvm.io/mpapis.asc | gpg2 --import - the key can be comparedwith: https://rvm.io/mpapis.asc https://keybase.io/mpapis NOTE:GPGversion2.1.17haveabug which cause failures during fetching keys from remoteserver.Please downgradeorupgradetonewer version(ifavailable)orusethe second method describedabove. 这一操作得到了: gpg2 –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 然后利用该密钥下载Ruby并升级。 [root@itfirstredis_cluster]# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 gpg:下载密钥‘D39DC0E3’,从hkp服务器keys.gnupg.net gpg: /root/.gnupg/trustdb.gpg:建立了信任度数据库 gpg:密钥D39DC0E3:公钥“Michal Papis(RVMsigning)<mpapis@gmail.com>”已导入 gpg:没有找到任何绝对信任的密钥 gpg:合计被处理的数量:1 gpg:已导入:1(RSA:1) [root@itfirstredis_cluster]# curl -sSL https://get.rvm.io | bash -s stable Downloadinghttps://github.com/rvm/rvm/archive/1.29.3.tar.gz Downloadinghttps://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc gpg:于2017年09月11日星期一04时59分21秒CST创建的签名,使用RSA,钥匙号BF04FF17 gpg:完好的签名,来自于“Michal Papis(RVMsigning)<mpapis@gmail.com>” gpg:亦即“MichalPapis<mpapis@gmail.com>” gpg:亦即“[jpeg image ofsize5015]” gpg:警告:这把密钥未经受信任的签名认证! gpg:没有证据表明这个签名属于它所声称的持有者。 主钥指纹:409B6B1796C275462A1703113804BB82 D39DC0E3 子钥指纹:62C9E5F4DA300D94AC36166BE206 C29F BF04 FF17 GPGverified'/usr/local/rvm/archives/rvm-1.29.3.tgz' Creatinggroup'rvm' Installing RVMto/usr/local/rvm/ Installation of RVMin/usr/local/rvm/isalmostcomplete: *First you needtoadd all users that will be using rvmto'rvm'group, andlogout-loginagain,anyone using rvm will be operatingwith`umasku=rwx,g=rwx,o=rx`. *Tostart using RVM you needtorun`source/etc/profile.d/rvm.sh` inall your open shellwindows,inrare cases you needtoreopen all shellwindows. 接着,source环境,让rvm可用。 [root@itfirst ~]# source /usr/local/rvm/scripts/rvm 查看Ruby可用版本 [root@itfirst~]# rvm list known # MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.7[-head]# security released on head [ruby-]1.9.1[-p431] [ruby-]1.9.2[-p330] [ruby-]1.9.3[-p551] [ruby-]2.0.0[-p648] [ruby-]2.1[.10] [ruby-]2.2[.7] [ruby-]2.3[.4] [ruby-]2.4[.1] ruby-head # for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2 # JRuby jruby-1.6[.8] jruby-1.7[.27] jruby[-9.1.13.0] jruby-head # Rubinius rbx-1[.4.3] rbx-2.3[.0] rbx-2.4[.1] rbx-2[.5.8] rbx-3[.84] rbx-head # Opal opal # Minimalistic ruby implementation - ISO 30170:2012 mruby-1.0.0 mruby-1.1.0 mruby-1.2.0 mruby-1[.3.0] mruby[-head] # Ruby Enterprise Edition ree-1.8.6 ree[-1.8.7][-2012.02] # Topaz topaz # MagLev maglev[-head] maglev-1.0.0 # Mac OS X Snow Leopard Or Newer macruby-0.10 macruby-0.11 macruby[-0.12] macruby-nightly macruby-head # IronRuby ironruby[-1.1.3] ironruby-head 可以看到最新的版本是2.4.1,本文安装2.3.0 至此,我们升级了Ruby的版本。 [root@itfirst~]# rvm install 2.3.0 Searchingforbinaryrubies,thismight take sometime. Found remote filehttps://rvm_io.global.ssl.fastly.net/binaries/centos/6/x86_64/ruby-2.3.0.tar.bz2 Checking requirementsforcentos. Installing requirementsforcentos. Installing requiredpackages:autoconf,automake,bison,libffi-devel,libtool,readline-devel,sqlite-devel,libyaml-devel.......... Requirements installationsuccessful. ruby-2.3.0-#configure ruby-2.3.0-#download %Total%Received%XferdAverage Speed TimeTime TimeCurrent DloadUpload Total SpentLeftSpeed 10021.9M10021.9M00266k00:01:240:01:24--:--:--278k No checksumfordownloadedarchive,recording checksuminuserconfiguration. ruby-2.3.0-#validate archive ruby-2.3.0-#extract ruby-2.3.0-#validate binary ruby-2.3.0-#setup ruby-2.3.0-#gemset created /usr/local/rvm/gems/ruby-2.3.0@global ruby-2.3.0-#importing gemset /usr/local/rvm/gemsets/global.gems.............................. ruby-2.3.0-#generating global wrappers........ ruby-2.3.0-#gemset created /usr/local/rvm/gems/ruby-2.3.0 ruby-2.3.0-#importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list ruby-2.3.0-#generating default wrappers........ 4)安装gem redis接口 [root@itfirst~]# rvm use 2.3.0 Using/usr/local/rvm/gems/ruby-2.3.0 [root@itfirst~]# rvm remove 1.8.7 ruby-1.8.7-head-#already gone Using/usr/local/rvm/gems/ruby-2.3.0 [root@itfirst~]#ruby --version ruby2.3.0p0(2015-12-25revision53290)[x86_64-linux] [root@itfirst~]# gem install redis Fetching:redis-4.0.1.gem(100%) Successfully installedredis-4.0.1 Parsing documentationforredis-4.0.1 Installing ri documentationforredis-4.0.1 Done installing documentationforredisafter0seconds 1geminstalled 5)安装rubygems # yum install -y rubygems 到目前为止,我们的Ruby和运行redis-trib.rb需要的环境安装完成了。 3、Redis集群搭建 有了Ruby执行环境,可以开始将之前的6个实例组建成集群了。 redis-trib.rb create --replicas 1 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 192.168.186.91:7003 192.168.186.91:7004 192.168.186.91:7005 有三个master,有三个是slave。 后面跟上6个实例就好了,形式就是ip:port 【此处有坑】 第一坑 [root@itfirstsrc]# redis-trib.rbcreate--replicas1 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 192.168.186.91:7003 192.168.186.91:7004 192.168.186.91:7005 -bash:redis-trib.rb:commandnotfound [root@itfirstsrc]# cp redis-trib.rb /usr/local/bin 需要将redis-trib.rb复制到/usr/local/bin目录下。 第二坑 [root@itfirstbin]# redis-trib.rbcreate--replicas1 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 192.168.186.91:7003 192.168.186.91:7004 192.168.186.91:7005 >>>Creatingcluster [ERR]Node192.168.186.91:7000isnotempty.Either the node already knows other nodes(check with CLUSTERNODES)orcontains some keyindatabase0. 踩完第一坑后,继续执行,发现了第二坑,还好有度娘,但是网上各种说法都有(主要参照了《极客on之路》的博客),发现错误的原因是redis数据库没有清除。 [root@itfirstsrc]# redis-cli -h 192.168.186.91 -p 7001 192.168.186.91:7001>flushdb OK 192.168.186.91:7001>quit [root@itfirstsrc]# redis-cli -h 192.168.186.91 -p 7002 192.168.186.91:7002>flushdb OK 192.168.186.91:7002>quit [root@itfirstsrc]# redis-cli -h 192.168.186.91 -p 7003 192.168.186.91:7003>flushdb OK 192.168.186.91:7003>quit [root@itfirstsrc]# redis-cli -h 192.168.186.91 -p 7004 192.168.186.91:7004>flushdb OK 192.168.186.91:7004>quit [root@itfirstsrc]# redis-cli -h 192.168.186.91 -p 7005 192.168.186.91:7005>flushdb OK 192.168.186.91:7005>quit [root@itfirstsrc]# redis-trib.rbcreate--replicas1 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 192.168.186.91:7003 192.168.186.91:7004 192.168.186.91:7005 >>>Creatingcluster >>>Performing hash slots allocationon6nodes... Using3masters: 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 Addingreplica192.168.186.91:7003to192.168.186.91:7000 Addingreplica192.168.186.91:7004to192.168.186.91:7001 Addingreplica192.168.186.91:7005to192.168.186.91:7002 M:61b2b608177374fd0382c872f996a2c25f62daac192.168.186.91:7000 slots:0-5460,9189(5462slots)master M:50e678c98c31baa4ece1cba096cc34b4545456f3192.168.186.91:7001 slots:5461-10922(5462slots)master M:b8dc855a92d1c9a6e358380286a757011c40601d192.168.186.91:7002 slots:9189,10923-16383(5462slots)master S:42392d8b4665500b3229b5c5b9dcebed311c9cdf192.168.186.91:7003 replicates61b2b608177374fd0382c872f996a2c25f62daac S:4e8cd9bae1dc0ffa63a3b8315e3f92b0490e65f8192.168.186.91:7004 replicates50e678c98c31baa4ece1cba096cc34b4545456f3 S:3344981c3290c39b0d9f427842398c17de835293192.168.186.91:7005 replicates b8dc855a92d1c9a6e358380286a757011c40601d CanIset the aboveconfiguration?(type'yes'toaccept):yes /usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis/client.rb:119:in`call': ERR Slot 9189 is already busy (Redis::CommandError) from /usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:2764:in `block in method_missing' from/usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:45:in`blockinsynchronize' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize' from/usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:45:in`synchronize' from /usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:2763:in `method_missing' from/usr/local/bin/redis-trib.rb:212:in`flush_node_config' from /usr/local/bin/redis-trib.rb:776:in `block in flush_nodes_config' from/usr/local/bin/redis-trib.rb:775:in`each' from /usr/local/bin/redis-trib.rb:775:in `flush_nodes_config' from/usr/local/bin/redis-trib.rb:1296:in`create_cluster_cmd' from /usr/local/bin/redis-trib.rb:1696:in `<main>' 第三坑 [root@itfirstsrc]# redis-trib.rbcreate--replicas1 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 192.168.186.91:7003 192.168.186.91:7004 192.168.186.91:7005 >>>Creatingcluster >>>Performing hash slots allocationon6nodes... Using3masters: 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 Addingreplica192.168.186.91:7003to192.168.186.91:7000 Addingreplica192.168.186.91:7004to192.168.186.91:7001 Addingreplica192.168.186.91:7005to192.168.186.91:7002 M:61b2b608177374fd0382c872f996a2c25f62daac192.168.186.91:7000 slots:0-5460,9189(5462slots)master M:50e678c98c31baa4ece1cba096cc34b4545456f3192.168.186.91:7001 slots:5461-10922(5462slots)master M:b8dc855a92d1c9a6e358380286a757011c40601d192.168.186.91:7002 slots:9189,10923-16383(5462slots)master S:42392d8b4665500b3229b5c5b9dcebed311c9cdf192.168.186.91:7003 replicates61b2b608177374fd0382c872f996a2c25f62daac S:4e8cd9bae1dc0ffa63a3b8315e3f92b0490e65f8192.168.186.91:7004 replicates50e678c98c31baa4ece1cba096cc34b4545456f3 S:3344981c3290c39b0d9f427842398c17de835293192.168.186.91:7005 replicates b8dc855a92d1c9a6e358380286a757011c40601d CanIset the aboveconfiguration?(type'yes'toaccept):yes /usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis/client.rb:119:in`call': ERR Slot 9189 is already busy (Redis::CommandError) from /usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:2764:in `block in method_missing' from/usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:45:in`blockinsynchronize' from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize' from/usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:45:in`synchronize' from /usr/local/rvm/gems/ruby-2.3.0/gems/redis-4.0.1/lib/redis.rb:2763:in `method_missing' from/usr/local/bin/redis-trib.rb:212:in`flush_node_config' from /usr/local/bin/redis-trib.rb:776:in `block in flush_nodes_config' from/usr/local/bin/redis-trib.rb:775:in`each' from /usr/local/bin/redis-trib.rb:775:in `flush_nodes_config' from/usr/local/bin/redis-trib.rb:1296:in`create_cluster_cmd' from /usr/local/bin/redis-trib.rb:1696:in `<main>' 还是度娘靠谱,在《redis 跨机器集群启动出错》博客中找到了答案。 这是由于之间创建集群没有成功,需要将nodes.conf和dir里面的文件全部删除。 [root@itfirst7000]# find / -name "nodes-7000.conf" /usr/local/redis-3.2.3/src/nodes-7000.conf [root@itfirst7000]# cd ../../ [root@itfirstsrc]# rm -rf nodes-700* 然后重启redis服务。 [root@itfirstsrc]# redis-trib.rbcreate--replicas1 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 192.168.186.91:7003 192.168.186.91:7004 192.168.186.91:7005 >>>Creatingcluster >>>Performing hash slots allocationon6nodes... Using3masters: 192.168.186.91:7000 192.168.186.91:7001 192.168.186.91:7002 Addingreplica192.168.186.91:7003to192.168.186.91:7000 Addingreplica192.168.186.91:7004to192.168.186.91:7001 Addingreplica192.168.186.91:7005to192.168.186.91:7002 M:319da27d8668a15d2d2d02afe433247694343459192.168.186.91:7000 slots:0-5460(5461slots)master M:3da756265e301ac0210760f13e990473f87a3017192.168.186.91:7001 slots:5461-10922(5462slots)master M:6f336da48c892d8e0c541a864765978ebfbca6d5192.168.186.91:7002 slots:10923-16383(5461slots)master S:ff4cf9d8a141d85c478b9af0358c93bca342c236192.168.186.91:7003 replicates319da27d8668a15d2d2d02afe433247694343459 S:43c2e0d7799e84b449803a68d557c3431e9e047e192.168.186.91:7004 replicates3da756265e301ac0210760f13e990473f87a3017 S:3f174fae106cb6cf7e7f21ed844895ed7c18f793192.168.186.91:7005 replicates6f336da48c892d8e0c541a864765978ebfbca6d5 CanIset the aboveconfiguration?(type'yes'toaccept):yes >>>Nodes configurationupdated >>>Assignadifferent config epochtoeachnode >>>Sending CLUSTER MEET messagestojoin the cluster Waitingforthe clustertojoin.... >>>Performing Cluster Check(usingnode192.168.186.91:7000) M:319da27d8668a15d2d2d02afe433247694343459192.168.186.91:7000 slots:0-5460(5461slots)master M:3da756265e301ac0210760f13e990473f87a3017192.168.186.91:7001 slots:5461-10922(5462slots)master M:6f336da48c892d8e0c541a864765978ebfbca6d5192.168.186.91:7002 slots:10923-16383(5461slots)master M:ff4cf9d8a141d85c478b9af0358c93bca342c236192.168.186.91:7003 slots:(0slots)master replicates319da27d8668a15d2d2d02afe433247694343459 M:43c2e0d7799e84b449803a68d557c3431e9e047e192.168.186.91:7004 slots:(0slots)master replicates3da756265e301ac0210760f13e990473f87a3017 M:3f174fae106cb6cf7e7f21ed844895ed7c18f793192.168.186.91:7005 slots:(0slots)master replicates6f336da48c892d8e0c541a864765978ebfbca6d5 [OK]All nodes agree about slotsconfiguration. >>>Checkforopenslots... >>>Check slotscoverage... [OK]All16384slotscovered. 4、验证集群状态 登录集群客户端,-c标识以集群方式登录 [root@itfirst src]# redis-cli -h 192.168.186.91 -c -p 7002 查看集群状态 192.168.186.91:7002>cluster info cluster_state:ok cluster_slots_assigned:16384 cluster_slots_ok:16384 cluster_slots_pfail:0 cluster_slots_fail:0 cluster_known_nodes:6 cluster_size:3 cluster_current_epoch:6 cluster_my_epoch:3 cluster_stats_messages_sent:124174 cluster_stats_messages_received:124174 192.168.186.91:7002>clusternodes 319da27d8668a15d2d2d02afe433247694343459192.168.186.91:7000master-015194659743071connected0-5460 3f174fae106cb6cf7e7f21ed844895ed7c18f793192.168.186.91:7005slave6f336da48c892d8e0c541a864765978ebfbca6d5015194659712786connected 6f336da48c892d8e0c541a864765978ebfbca6d5192.168.186.91:7002myself,master-003connected10923-16383 3da756265e301ac0210760f13e990473f87a3017192.168.186.91:7001master-015194659722882connected5461-10922 43c2e0d7799e84b449803a68d557c3431e9e047e192.168.186.91:7004slave3da756265e301ac0210760f13e990473f87a3017015194659732985connected ff4cf9d8a141d85c478b9af0358c93bca342c236192.168.186.91:7003slave319da27d8668a15d2d2d02afe433247694343459015194659692584connected www.codexueyuan.com

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册