一.YUM

We need to notice that the YUM source we want to build is the local file system YUM source, not the simple mount YUM source.


1.Vmware mount mirror image.


2.mkdir /yum


3.cd CentOS_6.6_Final/Package


4.cp * /yum


5.[[email protected] yum]# rpm -ivh deltarpm*

[[email protected] yum]# rpm -ivh python-deltarpm-* 

[[email protected] yum]# rpm -ivh createrepo* 

[[email protected] yum]# createrepo .


6.cd /etc/yum.repos.d
rm -rf *

vi yum.local.repo


[local]
name=yum local repo
baseurl=file:///yum
gpgcheck=0
enabled=1


7.yum clean all

yum install -y gcc*

Redis(Day01)


二.Redis:


1.Introduction

Redis is an open-source in-memory database project implementing a distributed, in-memory key-value store with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, hyperloglogs, bitmaps and spatial indexes. The project is mainly developed by Salvatore Sanfilippo and is currently sponsored by Redis Labs.[4] Redis Labscreates and maintains the official Redis Enterprise Pack. -- wiki


2.Startup procedure

Redis(Day01)

3.Command handle procedure

Redis(Day01) 

4.Relational DB:

ORACLE MYSQL SYBASE DB2 ....


5.Non tional DB:

REDIS MONGODB HBASE....


6.The difference between R-DB & Non R-DB:

(1)Non relational DB do not support transaction or half support. 

(2)Specifically, Non relational DB is driving by Key - Value(column corresponding DB)and relational DB is row corresponding DB

(3)Non relational DB usually cannot select data precisely, since it do not support SQL sentences.


7.Installation


1.Transfer redis(Xshell):
/usr/local/src


2.Install redis
mkdir -p /data/logs/redis /data/dbcache
mkdir /usr/local/redis
cd /usr/local/src
tar xzvf redis-3.0.7.tar.gz 
cd redis-3.0.7
make PREFIX=/usr/local/redis install #install in the designate directory 


3.modify system setting file.
   echo vm.overcommit_memory=1 >> /etc/sysctl.conf
   sysctl -p

number meaning:
0: Kernel will check memory space, if enough, it will permit application to use, otherwise kernel will forbid and return error to app.
1: Kernel will allocate all physical memory, no matter the current state of memory.
2: Kernel will allocate memory exceed the sum memory of physical memory and swap space.


4.vi /etc/profile
export REDIS_HOME=/usr/local/redis
export PATH=$PATH:$REDIS_HOME/bin

source /etc/profile


5.
Startup:

redis-server
Shutdown:
redis-cli shutdown


6.startup with arguments

(1)mkdir -p /usr/local/redis/etc


(2)cp /usr/local/src/redis-3.0.7/redis.conf /usr/local/redis/etc/


(3)vi redis.conf


(4)Master:

daemonize yes //leanding end or last end
pidfile /var/run/redis.pid //process number

port 12002 //port
timeout 0 //request overtime
tcp-keepalive 0 //
loglevel notice //record all log
logfile /data/logs/redis/stdout //path
databases 16 //max db
save 900 1
save 300 10
save 60 10000 //refresh disk
stop-writes-on-bgsave-error yes //
rdbcompression yes //keep permanent
rdbchecksum yes  
dbfilename dump.rdb //snapshot file name

dir /data/dbcache //snapshot directory path
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10


7.redis-server /usr/local/redis/etc/redis.conf


8.M - S:

Slave:

daemonize yes
pidfile /var/run/redis-slave.pid
port 12003
timeout 0
tcp-keepalive 0
loglevel notice
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump-slave.rdb
dir /data/dbcache/redis_12003
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
slaveof 192.168.16.100 12002


Test:

Redis(Day01)

Redis(Day01)

三.Shell

1.If

if [ ];then
xxxxx
elsif;then
xxxxx
else
xxxxx
fi


2.Numeric comparison
-eq ==
-lt <
-le <=
-gt >
-ge >=
!= !=

-f is file
-d id directory
-c character file
-b block file
-l link

-r read
-w write
-x execute

相关文章:

  • 2021-07-20
  • 2022-02-26
猜你喜欢
  • 2021-06-27
  • 2021-04-23
相关资源
相似解决方案