标签:
dubbo的整套环境主要有几个系统:tate@ubuntu:~$ uname -a Linux ubuntu 3.19.0-65-generic #73~14.04.1-Ubuntu SMP Wed Jun 29 21:05:22 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux说明:
tate@ubuntu:/tate/zookeeper-3.3.6$ vi /etc/hosts 127.0.0.1 localhost 127.0.1.1 ubuntu 127.0.0.1 lpubuntuserver
/tate /tate/jdk /tate/zookeeper-3.3.6 /tate/dubbo-monitor-simple /tate/tamcat-dubbo-admin /tate/redis-3.2.1
tate@ubuntu:/tate/jdk$ pwd /tate/jdk tate@ubuntu:/tate/jdk$ tar -xzvf /tate/soft/jdk-8u101-linux-x64.tar.gz tate@ubuntu:/tate/jdk$ ll total 12 drwxrwxr-x 3 tate tate 4096 Jul 23 19:57 ./ drwxrwxrwx 8 root root 4096 Jul 23 19:56 ../ drwxr-xr-x 8 tate tate 4096 Jun 22 03:13 jdk1.8.0_101/
tate@ubuntu:/tate/jdk$ vi /etc/profile # 在文件末尾添加 export JAVA_HOME=/tate/jdk/jdk1.8.0_101 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
tate@ubuntu:/tate/jdk$ source /etc/profile tate@ubuntu:/tate/jdk$ java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
tate@ubuntu:/tate$ pwd /tate tate@ubuntu:/tate$ tar -xzvf /tate/soft/zookeeper-3.3.6.tar.gz
tate@ubuntu:/tate/zookeeper-3.3.6/conf$ pwd /tate/zookeeper-3.3.6/conf tate@ubuntu:/tate/zookeeper-3.3.6/conf$ ll total 20 drwxr-xr-x 2 tate tate 4096 Jul 28 2012 ./ drwxr-xr-x 10 tate tate 4096 Jul 28 2012 ../ -rw-rw-r-- 1 tate tate 535 Jul 28 2012 configuration.xsl -rw-rw-r-- 1 tate tate 1698 Jul 28 2012 log4j.properties -rw-rw-r-- 1 tate tate 380 Jul 28 2012 zoo_sample.cfg tate@ubuntu:/tate/zookeeper-3.3.6/conf$ cp zoo_sample.cfg zoo.cfg tate@ubuntu:/tate/zookeeper-3.3.6/conf$ vi zoo.cfg # zoo.cfg最终配置及说明 # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # dataDir必须配置,在集群环境下,还需要在该目录下配置myid文件 dataDir=/tate/zookeeper-3.3.6/data # zookeeper日志存放目录 dataLogDir=/tate/zookeeper-3.3.6/logs # the port at which the clients will connect clientPort=2181 # cluster conf # 1,非集群环境下请删除以下配置 # 2,集群环境至少需要配置三个节点,因zookeeper的服务策略是当集群中的所以宕机机器数量大于总数量,即会停止服务。所以配置两个节点会导致服务启动失败 server.1=lpubuntuserver:2888:3888 server.2=lpubuntuserver2:2888:3888 server.3=lpubuntuserver3:2888:3888
# 系统启动环境变量 tate@ubuntu:/tate/zookeeper-3.3.6/bin$ sudo vi /etc/profile # 文件末尾添加zookeeper的环境变量 export ZOOKEEPER_HOME=/tate/zookeeper-3.3.6 export PATH=${ZOOKEEPER_HOME}/bin:$PATH # 立即生效文件 tate@ubuntu:/tate/zookeeper-3.3.6/bin$ source /etc/profile # 建立目录 tate@ubuntu:/tate/zookeeper-3.3.6$ pwd /tate/zookeeper-3.3.6 tate@ubuntu:/tate/zookeeper-3.3.6$ mkdir data tate@ubuntu:/tate/zookeeper-3.3.6$ mkdir logs # 集群配置,在zoo.cfg的server.{id}中,需要在data目录下建立myid文件,内容即为{id}的值 tate@ubuntu:/tate/zookeeper-3.3.6$ cd data/ tate@ubuntu:/tate/zookeeper-3.3.6/data$ vi myid # myid文件内容 1 # 相应的机器lpubuntu2的myid文件内容为2,lpubuntu3的myid文件内容为3
tate@ubuntu:/tate/zookeeper-3.3.6/bin$ pwd /tate/zookeeper-3.3.6/bin tate@ubuntu:/tate/zookeeper-3.3.6/bin$ ./zkServer.sh JMX enabled by default Using config: /tate/zookeeper-3.3.6/bin/../conf/zoo.cfg Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd} tate@ubuntu:/tate/zookeeper-3.3.6/bin$ sudo ./zkServer.sh start tate@ubuntu:/tate/zookeeper-3.3.6/bin$ sudo ./zkServer.sh stop
tate@ubuntu:/tate$ tar -xzvf /tate/soft/apache-tomcat-6.0.36.tar.gz tate@ubuntu:/tate$ mv apache-tomcat-6.0.36 tomcat6-dubbo-admin # 修改tomcat配置文件 tate@ubuntu:/tate/tomcat6-dubbo-admin/conf$ cd /tate tate@ubuntu:/tate$ cd tomcat6-dubbo-admin/conf/ tate@ubuntu:/tate/tomcat6-dubbo-admin/conf$ pwd /tate/tomcat6-dubbo-admin/conf tate@ubuntu:/tate/tomcat6-dubbo-admin/conf$ vi server.xml # 修改端口和字符集信息 <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> # 删除tomcat自带web程序 tate@ubuntu:/tate/tomcat6-dubbo-admin$ cd webapps/ tate@ubuntu:/tate/tomcat6-dubbo-admin/webapps$ ll total 28 drwxr-xr-x 7 tate tate 4096 Oct 16 2012 ./ drwxrwxr-x 9 tate tate 4096 Jul 23 21:11 ../ drwxr-xr-x 10 tate tate 4096 Jul 23 21:11 docs/ drwxr-xr-x 5 tate tate 4096 Jul 23 21:11 examples/ drwxr-xr-x 5 tate tate 4096 Jul 23 21:11 host-manager/ drwxr-xr-x 5 tate tate 4096 Jul 23 21:11 manager/ drwxr-xr-x 3 tate tate 4096 Jul 23 21:11 ROOT/ tate@ubuntu:/tate/tomcat6-dubbo-admin/webapps$ rm -rf * # 添加dubbo-admin tate@ubuntu:/tate/tomcat6-dubbo-admin/webapps$ cp /tate/soft/ROOT.war ROOT.war
tate@ubuntu:/tate/tomcat6-dubbo-admin/bin$ pwd /tate/tomcat6-dubbo-admin/bin tate@ubuntu:/tate/tomcat6-dubbo-admin/bin$ ./startup.sh Using CATALINA_BASE: /tate/tomcat6-dubbo-admin Using CATALINA_HOME: /tate/tomcat6-dubbo-admin Using CATALINA_TMPDIR: /tate/tomcat6-dubbo-admin/temp Using JRE_HOME: /tate/jdk/jdk1.8.0_101/jre Using CLASSPATH: /tate/tomcat6-dubbo-admin/bin/bootstrap.jar tate@ubuntu:/tate/tomcat6-dubbo-admin/bin$ ./shutdown.sh Using CATALINA_BASE: /tate/tomcat6-dubbo-admin Using CATALINA_HOME: /tate/tomcat6-dubbo-admin Using CATALINA_TMPDIR: /tate/tomcat6-dubbo-admin/temp Using JRE_HOME: /tate/jdk/jdk1.8.0_101/jre Using CLASSPATH: /tate/tomcat6-dubbo-admin/bin/bootstrap.jar
tate@ubuntu:/tate$ tar -xzvf /tate/soft/dubbo-monitor-simple-2.5.4-SNAPSHOT-assembly.tar.gz tate@ubuntu:/tate$ mv dubbo-monitor-simple-2.5.4-SNAPSHOT/ dubbo-monitor-simple # 修改配置文件 tate@ubuntu:/tate/dubbo-monitor-simple$ pwd /tate/dubbo-monitor-simple tate@ubuntu:/tate/dubbo-monitor-simple$ vi conf/dubbo.properties # 仅修改dubbo.registry.address为zookeeper dubbo.registry.address=zookeeper://lpubuntuserver:2181 # 如果是集群环境,则修改为: dubbo.registry.address=zookeeper://lpubuntuserver:2181?backup=lpubuntuserver2:2181,lpubuntuserver3:2181
tate@ubuntu:/tate/dubbo-monitor-simple/bin$ pwd /tate/dubbo-monitor-simple/bin tate@ubuntu:/tate/dubbo-monitor-simple/bin$ ./start.sh Starting the simple-monitor ......OK! PID: 4648 STDOUT: logs/stdout.log tate@ubuntu:/tate/dubbo-monitor-simple/bin$ ./stop.sh
tate@ubuntu:/tate$ pwd /tate tate@ubuntu:tar -xzvf /tate/soft/redis-3.2.1.tar.gz tate@ubuntu:cd redis-3.2.1/ tate@ubuntu:make tate@ubuntu:sudo make install # 编辑内存配置文件 tate@ubuntu:sudo vi /etc/sysctl.conf # 文件末尾添加: vm.overcommit_memory=1 # 执行命令: tate@ubuntu:sudo sysctl vm.overcommit_memory=1
tate@ubuntu:/tate/redis-3.2.1$ pwd /tate/redis-3.2.1 tate@ubuntu:/tate/redis-3.2.1$ vi redis.conf # 必要的修改参数 # 监听端口号,默认为 6379,如果你设为 0 ,redis 将不在 socket 上监听任何客户端连接。 port 6379 # TCP 监听的最大容纳数量 # # 在高并发的环境下,你需要把这个值调高以避免客户端连接缓慢的问题。 # Linux 内核会一声不响的把这个值缩小成 /proc/sys/net/core/somaxconn 对应的值, # 所以你要修改这两个值才能达到你的预期。 tcp-backlog 511 # 默认情况下,只能本机访问。 # 你如果只想让它在一个网络接口上监听,那你就绑定一个IP或者多个IP。如不屏蔽,则默认只能本机访问 # 示例,多个IP用空格隔开:bind 192.168.1.100 10.0.0.1 # bind 127.0.0.1 # 指定在一个 client 空闲多少秒之后关闭连接(0 就是不管它) timeout 0 # 设置认证密码 # requirepass tate # 定义日志级别。 # 可以是下面的这些值: # debug (适用于开发或测试阶段) # verbose (many rarely useful info, but not a mess like the debug level) # notice (适用于生产环境) # warning (仅仅一些重要的消息被记录) loglevel notice # 指定日志文件的位置 logfile ""
tate@ubuntu:/tate/redis-3.2.1$ /usr/local/bin/redis-server /tate/redis-3.2.1/redis.conf # 关闭reids服务,直接杀进程 # close redis REDIS_PID=`pgrep redis` if [ -z "${REDIS_PID}" ]; then echo "redis not start" else `kill -9 ${REDIS_PID}` echo "redis is stop" fi
clientPort | |
dataDir | |
tickTime | |
dataLogDir | |
globalOutstandingLimit | |
preAllocSize | |
snapCount | |
traceFile | |
maxClientCnxns | |
clientPortAddress | |
minSessionTimeoutmaxSessionTimeout | |
fsync.warningthresholdms | |
autopurge.purgeInterval | |
autopurge.snapRetainCount | |
electionAlg | |
initLimit | |
syncLimit | |
leaderServes | |
server.x=[hostname]:nnnnn[:nnnnn] | |
group.x=nnnnn[:nnnnn]weight.x=nnnnn | |
cnxTimeout | |
zookeeper.DigestAuthenticationProvider .superDigest | |
skipACL | |
forceSync | |
jute.maxbuffer |
|
daemonize yes #---默认值no,该参数用于定制redis服务是否以守护模式运行。--- pidfile /var/run/redis.pid #默认值/var/run/redis.pid,指定redis服务的进程号文件路径,以守护模式运行时需要配置本参数; port 6379 #默认值6379,指定redis服务的端口 # bind 127.0.0.1 #绑定ip,默认是本机所有网络设备; timeout 0 #客户端空闲n秒后断开连接;默认是 0 表示不断开。 loglevel notice ###设置服务端的日志级别,有下列几种选择: debug:记录详细信息,用于开发或调试; verbose:提供很多有用的信息,但是又不像debug那么详尽,默认就是这一选项; notice:适度提醒,多用于产品环境; warning:仅显示重要的警告信息; logfile "" ##指定日志的输出路径,默认值stdout,表示输出到屏幕,守护模式时则输出到/dev/null; 如果要输出日志到syslog中,可以启动syslog-enabled yes,默认该选项值为no。 # syslog-enabled no databases 16 ###指定数据库的数量,默认为16个,默认使用的数据库是DB 0。 ################################ SNAPSHOTTING ################################ ----以下为快照相关的设置:------ # save <seconds> <changes> ##指定多长时间刷新快照至磁盘,这个选项有两个属性值,只有当两个属性值均满足时才会触发;可以设置多种级别,例如默认的参数文件中就设置了: save 900 1:每900秒(15分钟)至少一次键值变更时被触发; save 300 10:每300秒(5分钟)至少10次键值变更时被触发; save 60 10000:每60秒至少10000次键值变更时被触发; save 900 1 save 300 10 save 60 10000 rdbcompression yes ##默认值yes,当dump数据库时使用LZF压缩字符串对象,如果CPU资源比较紧张,可以设置为no,选择不压缩; rdbchecksum yes # The filename where to dump the DB 数据库文件名 dbfilename dump.rdb ##默认值dump.rdb,dump到文件系统中的文件名 dir /usr/local/redis/db ##默认值./,即当前目录,dump出的数据文件的存储路径; ################################# REPLICATION ################################# ----以下为复制相关的设置,复制默认是不启用的,因此在默认的参数文件下列表参数均被注释---- # slaveof <masterip> <masterport> ##指定主端ip和端口,用于创建一个镜像服务 # masterauth <master-password> ##如果master配置了密码的话,此处也需做设置; slave-serve-stale-data yes ##默认值yes。当slave丢失与master端的连接,或者复制仍在处理,那么slave会有下列两种表现: 当本参数值为yes时,slave为继续响应客户端请求,尽管数据已不同步甚至没有数据(出现在初次同步的情况下); 当本参数值为no时,slave会返回"SYNC with master in progreee"的错误信息; slave-read-only yes ##默认从Redis是只读模式 # repl-ping-slave-period 10 ###默认值10,指定slave定期ping master的周期; # repl-timeout 60 ##默认值60,指定超时时间。注意本参数包括批量传输数据和ping响应的时间。 ################################## SECURITY ################################### ------以下为安全相关的设置------ # requirepass foobared ###指定一个密码,客户端连接时也需要通过密码才能成功连接; # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 ###重定义命令,例如将CONFIG命令更名为一个很复杂的名字: # rename-command CONFIG "" 取消这个命令; ################################### LIMITS #################################### -----以下为资源限制方面的设置------ # maxclients 10000 ##指定客户端的最大并发连接数,默认是没有限制,直到redis无法创建新的进程为止,设置该参数值为0也表示不限制,如果该参数指定了值,当并发连接达到指定值时,redis会关闭所有新连接,并返回'max number of clients reached'的错误信息; # maxmemory <bytes> ###设置redis最大可使用内存。当达到最大内存后,redis会尝试按照设置的回收策略删除键值。如果无法删除键值,或者保留策略设置为不清除,那么redis就会向发出内存的请求返回错误信息。当把redis做为一级LRU的缓存时本参数较为有用。 # maxmemory-policy volatile-lru ###默认值volatile-lru,指定清除策略,有下列几种方法: volatile-lru -> remove the key with an expire set using an LRU algorithm allkeys-lru -> remove any key accordingly to the LRU algorithm volatile-random -> remove a random key with an expire set allkeys->random -> remove a random key, any key volatile-ttl -> remove the key with the nearest expire time (minor TTL) noeviction -> don't expire at all, just return an error on write operations # maxmemory-samples 3 ###默认值3,LRU和最小TTL策略并非严谨的策略,而是大约估算的方式,因此可以选择取样值以便检查。 ############################## APPEND ONLY MODE ############################### -----以下为APPEND的配置---- ONLY模式的设置,默认情况下redis采用异步方式dump数据到磁盘上,极端情况下这可能会导致丢失部分数据(比如服务器突然宕机),如果数据比较重要,不希望丢失,可以启用直写的模式,这种模式下redis会将所有接收到的写操作同步到appendonly.aof文件中,该文件会在redis服务启动时在内存中重建所有数据。注意这种模式对性能影响非常之大。 appendonly no ##默认值no,指定是否启用直写模式; # appendfilename appendonly.aof ###直写模式的默认文件名appendonly.aof appendfsync:调用fsync()方式让操作系统写数据到磁盘上,数据同步方式,有下列几种模式: always:每次都调用,比如安全,但速度最慢; everysec:每秒同步,这也是默认方式; no:不调用fsync,由操作系统决定何时同步,比如快的模式; no-appendfsync-on-rewrite:默认值no。当AOF fsync策略设置为always或everysec,后台保存进程会执行大量的I/O操作。某些linux配置下redis可能会阻塞过多的fsync()调用。 auto-aof-rewrite-percentage:默认值100 auto-aof-rewrite-min-size:默认值64mb # appendfsync always appendfsync everysec # appendfsync no ############################### ADVANCED CONFIG ############################### -----以下为高级配置相关的设置---- hash-max-zipmap-entries:默认值512,当某个map的元素个数达到最大值,但是其中最大元素的长度没有达到设定阀值时,其HASH的编码采用一种特殊的方式(更有效利用内存)。本参数与下面的参数组合使用来设置这两项阀值。设置元素个数; hash-max-zipmap-value:默认值64,设置map中元素的值的最大长度;这两个 list-max-ziplist-entries:默认值512,与hash类似,满足条件的list数组也会采用特殊的方式以节省空间。 list-max-ziplist-value:默认值64 set-max-intset-entries:默认值512,当set类型中的数据都是数值类型,并且set中整型元素的数量不超过指定值时,使用特殊的编码方式。 zset-max-ziplist-entries:默认值128,与hash和list类似。 zset-max-ziplist-value:默认值64 activerehashing:默认值yes,用来控制是否自动重建hash。Active rehashing每100微秒使用1微秒cpu时间排序,以重组Redis的hash表。重建是通过一种lazy方式,写入hash表的操作越多,需要执行rehashing的步骤也越多,如果服务器当前空闲,那么rehashing操作会一直执行。如果对实时性要求较高,难以接受redis时不时出现的2微秒的延迟,则可以设置activerehashing为no,否则建议设置为yes,以节省内存空间。
标签:
原文地址:http://blog.csdn.net/szzt_lingpeng/article/details/52012639