分页: 23/196 第一页 上页 18 19 20 21 22 23 24 25 26 27 下页 最后页 [ 显示模式: 摘要 | 列表 ]
Jan 9

1.要尝试使用MongoDB首先必须要在命令行运行mongod服务
a. cd MONGO_HOME/bin
b. ./mongod --dbpath /data/mongodb/db/  --logpath /data/mongodb/logs/mongolog  --logappend --fork

参数说明
--dbpath            #指定db文件存放的目录
--port              #指定mongod服务使用的端口
--fork              #设置mongo服务为后台运行
--logpath           #指定log文件的目录和文件名
--logappend         #设置每次log添加在文件最后
--rest              #关闭rest api功能
--nohttpinterface   #关闭web管理功能
--auth              #指定mongo使用身份验证机制
--bindip            #用逗号分隔ip地址,用来指定
--f                 #将所有前面介绍的参数都可以存放到一个配置文件中,然后用这个参数调用配置文件来启动mongod服务

2.关闭MongoDB有几种方法
a. db.shutdownServer()  #推荐优先使用
b. ctrl + c             #在不使用 --fork参数的时候可以使用,可能会造成数据文件损坏
c. kill / kill -2       #在无法使用 a和b的情况下使用,可能会造成数据文件损坏
d. kill -9              #不在万不得已的情况下,不要使用这个方法

3. 查看MongoDB状态
a.db.runCommand({"serverStatus":1})
b.MONGO_HOME/bin/mongostat

4. 添加用户,切换用户 使 --auth参数起效
db.addUser("root","123")
db.addUser("read_only","123",true);  #第3个参数表示设置readonly的状态

db.auth("read_only","123")

5. 数据库备份
有4种方法备份数据库
a. 关闭mongod服务后,复制--dbpath参数指定的数据文件。优点速度快,缺点需要停止mongo服务。
b. 使用mongodump 导出数据,并用mongorestore 导入数据。优点不需要停止mongo服务,缺点在mongodump操作时用户插入的数据可能无法备份出来。
c. fsync and lock锁定数据库的让用户只能使用read功能,再使用方法b导出并导入数据。优点不需要停止mongo服务,缺点在数据库lock期间用户无法执行insert操作。
d. 使用slaveDB并且 使用方法c锁定slaveDB,再使用方法b导出并导入数据。优点不需要停止mongo服务,不会影响用户insert操作(推荐使用此方法)。

6. 修复数据库
当数据库文件遭到损坏的时候有3种方法修复数据文件
a. MONGO_HOME/bin/mongod --repair
b. use test
   db.repairDatabase()
c. db.runCommand({"repairDatabase":1});

Tags: , ,
Sep 24
由于脚本编写时出错导致可能存在pathinfo漏洞,请所有lnmp用户检查一下php的pathinfo设置!!!

编辑/usr/local/webserver/php/etc/php.ini 文件,搜索 cgi.fix_pathinfo ,如果cgi.fix_pathinfo 该行为 ; cgi.fix_pathinfo=0 请修改为 cgi.fix_pathinfo=0
或直接执行:sed -i 's/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g' /usr/local/webserver/php/etc/php.ini

再执行:/usr/local/webserver/php/sbin/php-fpm restart 重启php-fpm

如果是cgi.fix_pathinfo=0则没问题,不需要修改。
请各位lnmp(linux+nginx+mysql+php)用户检查一下,防止pathinfo漏洞给网站或服务器带来安全隐患。
Tags: ,
Sep 23
在家搭配了一个模拟的环境,创建了几个虚拟机,今天远程连接到机器上使用内网IP连接到其他内网机器时,出现以下错误提示:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
a1:ee:9e:76:32:ab:79:83:21:c1:d1:eb:35:44:fe:b4.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:13
RSA host key for 192.168.1.6 has changed and you have requested strict checking.
Host key verification failed.
原因就是在上次登录到那台机器之后,我把那台虚拟机重新做了系统,导致Host key和之前保存的不一致,所以提示KEY 验证失败不能登录。
解决方法很简单: vi /root/.ssh/known_hosts 删除掉那个IP对应的公钥,保存退出再连接就可以了。
Sep 23
I added a new slave. I tried to create a new vps with centos 5.x on the new slave. I receive error

Alert: Could Not Start Vps, Reason: Error: Kernel image does not exist: /boot/hypervm-xen-vmlinuz:

Issue command below

cd /usr/local/lxlabs/hypervm/httpdocs/
lphp.exe ../bin/misc/fixcentos5xen.php
Tags: ,
Sep 3
一.文件系统调节
1.硬盘不要使用RAID
2.使用性能好的FS(例如: ReiserFS)
在fstab里面添加noatime,async项,提高文件系统的性能.
二. aufs存储机制
编辑squid-2.6.STABLE13/src/fs/aufs/store_asyncufs.h
#define ASYNC_WRITE 0 (把0修改为:1)
pthread_create(), SMP优越. (线程制)
编辑squid-2.6.STABLE13/include/autoconf.h
define DEFAULT_FD_SETSIZE 1024{1024修改为:65536}
diskd存储机制
通过消息队列和共享内存来实现进程间通信
使用Diskd存储机制而对 kernel.msgmnb等的调整
kernel.msgmnb = 16384
每个消息队列的最大字节限制
kernel.msgmni = 16 (此值可以根据需要增大)
整个系统的最大数量的消息队列, Squid对每个Cache_dir 使用两个队列, 假如你有2个磁盘,那就有2个队列.
kernel.msgmax = 8192
每个消息的最大size.

引用

[root@jackbillow~]# sysctl -a |grep msgmnb
kernel.msgmnb = 16384
[root@jackbillow ~]# sysctl -a |grep msgmni
kernel.msgmni = 16
[root@jackbillow ~]# sysctl -a |grep msgmax
kernel.msgmax = 8192
[root@jackbillow ~]# sysctl -a |grep shmall
kernel.shmall = 2097152
[root@jackbillow ~]# sysctl -a |grep shmmni
kernel.shmmni = 4096
[root@jackbillow~]# sysctl -a |grep shmmax
kernel.shmmax = 2147483648
Tags: ,
分页: 23/196 第一页 上页 18 19 20 21 22 23 24 25 26 27 下页 最后页 [ 显示模式: 摘要 | 列表 ]