redis-cli -h ip -p 6401 -a password cluster info<br>
2.集群节点信息redis-cli -h ip -p 6401 -a password cluster nodes<br>
3.节点内存、cpu、key数量等信息(每个节点都需查看)redis-cli -h ip -p 6401 -a password info<br>
4.从redis集群中查看key(只需要连接master节点查看)redis-cli -h ip -p 6401 -a password keys *<br>
b.查看key的value值redis-cli -h ip -p 6401 -a password -c get key<br>
c.查看key值得有效期redis-cli -h ip -p 6401 -a password -c ttl key
ssh root@ip
Password: password
keys *
查看存储的数据剩余过期时间
ttl key<br>
查看key的类型(string,set,list,hash)
type key<br>
查看key的值(string类型)
get key<br>
查看key的值(set类型)
scard key //获取 set 集合中元素的数量
smembers key //查看 set 中的内容<br>
查看key的值(hash类型)
hlen key //获取 key 键的字段数量
hgetall key //返回 key 键的所有字段及其值
hkeys key //获取 key 键中所有字段的名字
hvals key //获取 key 键中所有字段的值
nohup Command [ Arg ... ] [ & ]
参数说明:nohup /root/runoob.sh &
在终端如果看到以下输出说明运行成功:appending output to nohup.out
这时我们打开 root 目录 可以看到生成了 nohup.out 文件。ps -aux | grep "runoob.sh"
参数说明:kill -9 进程号PID
以下命令在后台执行 root 目录下的 runoob.sh 脚本,并重定向输入到 runoob.log 文件:nohup /root/runoob.sh > runoob.log 2>&1 &
2>&1 解释:0 – stdin (standard input,标准输入)
1 – stdout (standard output,标准输出)
2 – stderr (standard error,标准错误输出)
yum install -y epel-release
yum install -y supervisor
systemctl enable supervisord # 开机自启动
systemctl start supervisord # 启动supervisord服务
# systemctl status supervisord # 查看supervisord服务状态
supervisord
运行supervisor时会启动一个进程supervisord,它负责启动所管理的进程,并将所管理的进程作为自己的子进程来启动,而且可以在所管理的进程出现崩溃时自动重启systemctl restart supervisord
supervisorctl (命令管理工具)
可以用来执行start、stop、restart等命令,来对这些子进程进行管理supervisorctl start hyperf
# 重启 hyperf 应用supervisorctl restart hyperf
# 停止 hyperf 应用supervisorctl stop hyperf
# 查看所有被管理项目运行状态supervisorctl status
# 重新加载配置文件supervisorctl update
# 重新启动所有程序supervisorctl reload
网页管理vim /etc/supervisor.conf
[inet_http_server]
port=127.0.0.1:9001
;username=test
;password=123456
systemctl start supervisord
# sudo /usr/bin/supervisord -n -c /etc/supervisord.conf
打开浏览器,输入地址127.0.0.1:9001help
help <action>
shutdown
重载配置文件并重启supervisord和programreload
读取当前运行配置和program配置文件的差异reread
重载配置文件并重启受影响的programupdate
重启program(不会重载配置文件)restart <name>
restart <name> <name>
restart all
clear <name>
clear <name> <name>
clear all
fg <name>
显示supervisord或program IDpid
pid <name>
pid all
start <name>
start <name> <name>
start all
停止programstop <name>
stop <name> <name>
stop all
status <name>
status <name> <name>
status
tail [-f] <name> [stdout|stderr] (default stdout)
输出supervisord最新日志(Ctrl+C退出)maintail [-f]
$stream_opts = [
"ssl" => [
"verify_peer"=>false,
"verify_peer_name"=>false,
]
];
$response = file_get_contents($url, false, stream_context_create($stream_opts));
dd if=/dev/zero of=swapfile bs=1024 count=500000
500000+0 records in
500000+0 records out
512000000 bytes (512 MB) copied, 0.847481 s, 604 MB/s
ll
total 500000
-rw-r--r-- 1 root root 512000000 Sep 11 16:24 swapfile
[root@dics-no iflytek]# mkswap swapfile
Setting up swapspace version 1, size = 499996 KiB
no label, UUID=bf7c48ab-d829-4291-a477-f75cdd33f72a
[root@dics-no iflytek]#
[root@dics-no iflytek]# swapon swapfile
swapon: swapfile: insecure permissions 0644, 0600 suggested.
[root@dics-no iflytek]#
[root@dics-no iflytek]# free -h
total used free shared buffers cached
Mem: 31G 918M 30G 8.3M 704K 589M
-/+ buffers/cache: 328M 30G
Swap: 488M 0B 488M
[root@dics-no iflytek]#
删除swapfile[root@i-5608690E /]# swapoff swapfile
然后再执行删除文件操作[root@i-5608690E /]# rm swapfile
注:如果没有执行swapoff操作,就执行执行删除文件的操作,系统会报错,不给删除。swapoff相当于是卸载swap分区。ls -l | grep "^-"
我们可以用wc命令进行统计:ls -l ./|grep "^-"|wc -l
3.统计文件夹中目录个数ls -l ./|grep "^d"|wc -l
4.统计文件夹下文件个数,包括子文件ls -lR | grep "^-"| wc -l
5.统计文件夹下目录个数,包括子目录ls -lR | grep "^d"| wc -l
./yii migrate/create test_user
执行后,就会在/console/migrations/下面生成m160511_080937_test_user.php。[root@services datacenter_1000]# ./yii migrate/create test_user
Yii Migration Tool (based on Yii v2.0.7)
Create new migration '/www/web/datacenter/datacenter_1000/console/migrations/m160511_080937_test_user.php'? (yes|no) [no]:yes
New migration created successfully.
./yii migrate --migrationPath=@yii/log/migrations/
同样 down() , 采用 safeDown()方法。yii\db\Migration::execute(): 执行一条 SQL 语句
yii\db\Migration::insert(): 插入单行数据
yii\db\Migration::batchInsert(): 插入多行数据
yii\db\Migration::update(): 更新数据
yii\db\Migration::delete(): 删除数据
yii\db\Migration::createTable(): 创建表
yii\db\Migration::renameTable(): 重命名表名
yii\db\Migration::dropTable(): 删除一张表
yii\db\Migration::truncateTable(): 清空表中的所有数据
yii\db\Migration::addColumn(): 加一个字段
yii\db\Migration::renameColumn(): 重命名字段名称
yii\db\Migration::dropColumn(): 删除一个字段
yii\db\Migration::alterColumn(): 修改字段
yii\db\Migration::addPrimaryKey(): 添加一个主键
yii\db\Migration::dropPrimaryKey(): 删除一个主键
yii\db\Migration::addForeignKey(): 添加一个外键
yii\db\Migration::dropForeignKey(): 删除一个外键
yii\db\Migration::createIndex(): 创建一个索引
yii\db\Migration::dropIndex(): 删除一个索引
yii migrate 3
你也可以指定一个特定的迁移,按照如下格式使用 migrate/to 命令来指定数据库应该提交哪一个迁移:yii migrate/to 150101_185401 # using timestamp to specify the migration 使用时间戳来指定迁移
yii migrate/to "2015-01-01 18:54:01" # using a string that can be parsed by strtotime() 使用一个可以被 strtotime() 解析的字符串
yii migrate/to m150101_185401_create_news_table # using full name 使用全名
yii migrate/to 1392853618 # using UNIX timestamp 使用 UNIX 时间戳
yii migrate/down # revert the most recently applied migration 还原最近一次提交的迁移
yii migrate/down 3 # revert the most 3 recently applied migrations 还原最近三次提交的迁移
yii migrate/redo # redo the last applied migration 重做最近一次提交的迁移
yii migrate/redo 3 # redo the last 3 applied migrations 重做最近三次提交的迁移
yii migrate/history # 显示最近10次提交的迁移
yii migrate/history 5 # 显示最近5次提交的迁移
yii migrate/history all # 显示所有已经提交过的迁移
yii migrate/new # 显示前10个还未提交的迁移
yii migrate/new 5 # 显示前5个还未提交的迁移
yii migrate/new all # 显示所有还未提交的迁移
yii migrate/mark 150101_185401 # 使用时间戳来指定迁移
yii migrate/mark "2015-01-01 18:54:01" # 使用一个可以被 strtotime() 解析的字符串
yii migrate/mark m150101_185401_create_news_table # 使用全名
yii migrate/mark 1392853618 # 使用 UNIX 时间戳
lsblk
选择自己要挂载的硬盘,不要选错了sudo parted /dev/sdb #使用parted来对GPT磁盘操作,进入交互式模式
(parted) mklabel gpt # 将MBR磁盘格式化为GPT
(parted) mkpart primary ext4 0% 100% 将所有容量分为一个主分区
(parted) p #打印当前分区
(parted) q #退出
sudo mkfs.ext4 /dev/sdb1
四、挂载sudo mkdir /disk1
sudo mount /dev/sdb1 /disk1 #挂载在disk1上
sudo blkid
六、修改/etc/fstabUUID=cf116c95-b7f0-4ce4-b0da-7f2856784c43 /disk1 ext4 defaults 0 2
var index = layer.open();
var index = layer.alert();
var index = layer.load();
var index = layer.tips();
正如你看到的,每一种弹层调用方式,都会返回一个indexlayer.close(index); //此时你只需要把获得的index,轻轻地赋予layer.close即可
如果你想关闭最新弹出的层,直接获取layer.index即可layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
当你在iframe页面关闭自身时var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.layer.close(index); //再执行关闭