一、paramiko介绍

  paramiko是基于Python实现的SSH2远程安全连接,支持认证及密钥方式。可以实现远程命令执行、文件传输、中间SSH代理等功能,相对于Pexpect,封装的层次更高,更贴近SSH协议的功能

官网地址:http://www.paramiko.org/installing.html

       http://docs.paramiko.org/en/2.4/

       https://pypi.org/project/paramiko/

二、paramiko安装

root@localhost ~]# pip3 install paramiko

简单实现远程SSH运行命令示例

import paramiko

hostname = '192.168.56.132'
username = 'root'
password = ''
paramiko.util.log_to_file('syslogin.log') #发送paramiko日志到syslogin.log文件 ssh = paramiko.SSHClient() #创建一个SSH客户端client对象
ssh.load_system_host_keys() #获取客户端host_keys,默认~/.ssh/known_hosts,非默认路径需指定
ssh.connect(hostname=hostname,username=username,password=password) #创建SSH连接
stdin,stdout,stderr = ssh.exec_command('free -m') #调用远程执行命令方法exec_command()
print(stdout.read().decode('utf-8')) #打印命令执行结果,得到Python列表形式,可以使用stdout_readlines()
ssh.close() #关闭SSH连接

程序运行结果如下图所示:

[root@localhost p_paramiko]# cat syslogin.log
DEB [-::47.022] thr= paramiko.transport: starting thread (client mode): 0xf5b8d668
DEB [-::47.023] thr= paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.4.1
DEB [-::47.026] thr= paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_5.
INF [-::47.026] thr= paramiko.transport: Connected (version 2.0, client OpenSSH_5.)
DEB [-::47.027] thr= paramiko.transport: kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] client mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEB [-::47.028] thr= paramiko.transport: Kex agreed: diffie-hellman-group-exchange-sha256
DEB [-::47.028] thr= paramiko.transport: HostKey agreed: ssh-rsa
DEB [-::47.028] thr= paramiko.transport: Cipher agreed: aes128-ctr
DEB [-::47.028] thr= paramiko.transport: MAC agreed: hmac-sha2-
DEB [-::47.028] thr= paramiko.transport: Compression agreed: none
DEB [-::47.072] thr= paramiko.transport: Got server p ( bits)
DEB [-::47.139] thr= paramiko.transport: kex engine KexGexSHA256 specified hash_algo <built-in function openssl_sha256>
DEB [-::47.139] thr= paramiko.transport: Switch to new keys ...
DEB [-::47.182] thr= paramiko.transport: userauth is OK
INF [-::47.351] thr= paramiko.transport: Authentication (password) successful!
DEB [-::47.352] thr= paramiko.transport: [chan ] Max packet in: bytes
DEB [-::47.353] thr= paramiko.transport: [chan ] Max packet out: bytes
DEB [-::47.353] thr= paramiko.transport: Secsh channel opened.
DEB [-::47.354] thr= paramiko.transport: [chan ] Sesch channel request ok
DEB [-::47.360] thr= paramiko.transport: [chan ] EOF received ()
DEB [-::26.006] thr= paramiko.transport: starting thread (client mode): 0x5f2736d8
DEB [-::26.006] thr= paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.4.1
DEB [-::26.010] thr= paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_5.
INF [-::26.010] thr= paramiko.transport: Connected (version 2.0, client OpenSSH_5.)
DEB [-::26.010] thr= paramiko.transport: kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] client mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEB [-::26.010] thr= paramiko.transport: Kex agreed: diffie-hellman-group-exchange-sha256
DEB [-::26.010] thr= paramiko.transport: HostKey agreed: ssh-rsa
DEB [-::26.011] thr= paramiko.transport: Cipher agreed: aes128-ctr
DEB [-::26.011] thr= paramiko.transport: MAC agreed: hmac-sha2-
DEB [-::26.011] thr= paramiko.transport: Compression agreed: none
DEB [-::26.054] thr= paramiko.transport: Got server p ( bits)
DEB [-::26.119] thr= paramiko.transport: kex engine KexGexSHA256 specified hash_algo <built-in function openssl_sha256>
DEB [-::26.119] thr= paramiko.transport: Switch to new keys ...
DEB [-::26.162] thr= paramiko.transport: userauth is OK
INF [-::26.243] thr= paramiko.transport: Authentication (password) successful!
DEB [-::26.243] thr= paramiko.transport: [chan ] Max packet in: bytes
DEB [-::26.244] thr= paramiko.transport: [chan ] Max packet out: bytes
DEB [-::26.244] thr= paramiko.transport: Secsh channel opened.
DEB [-::26.245] thr= paramiko.transport: [chan ] Sesch channel request ok
DEB [-::26.250] thr= paramiko.transport: [chan ] EOF received ()
DEB [-::19.574] thr= paramiko.transport: starting thread (client mode): 0x4546a710
DEB [-::19.574] thr= paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.4.1
DEB [-::19.578] thr= paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_5.
INF [-::19.578] thr= paramiko.transport: Connected (version 2.0, client OpenSSH_5.)
DEB [-::19.579] thr= paramiko.transport: kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] client mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEB [-::19.579] thr= paramiko.transport: Kex agreed: diffie-hellman-group-exchange-sha256
DEB [-::19.579] thr= paramiko.transport: HostKey agreed: ssh-rsa
DEB [-::19.579] thr= paramiko.transport: Cipher agreed: aes128-ctr
DEB [-::19.579] thr= paramiko.transport: MAC agreed: hmac-sha2-
DEB [-::19.579] thr= paramiko.transport: Compression agreed: none
DEB [-::19.580] thr= paramiko.transport: Got server p ( bits)
DEB [-::19.639] thr= paramiko.transport: kex engine KexGexSHA256 specified hash_algo <built-in function openssl_sha256>
DEB [-::19.640] thr= paramiko.transport: Switch to new keys ...
DEB [-::19.682] thr= paramiko.transport: userauth is OK
INF [-::19.817] thr= paramiko.transport: Authentication (password) successful!
DEB [-::19.817] thr= paramiko.transport: [chan ] Max packet in: bytes
DEB [-::19.818] thr= paramiko.transport: [chan ] Max packet out: bytes
DEB [-::19.818] thr= paramiko.transport: Secsh channel opened.
DEB [-::19.820] thr= paramiko.transport: [chan ] Sesch channel request ok
DEB [-::19.824] thr= paramiko.transport: [chan ] EOF received ()
DEB [-::23.623] thr= paramiko.transport: starting thread (client mode): 0xd3c8710
DEB [-::23.624] thr= paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.4.1
DEB [-::23.627] thr= paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_5.
INF [-::23.627] thr= paramiko.transport: Connected (version 2.0, client OpenSSH_5.)
DEB [-::23.627] thr= paramiko.transport: kex algos:['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] client mac:['hmac-md5', 'hmac-sha1', 'umacimport paramiko
-@openssh.com', 'hmac-sha2-', 'hmac-sha2-', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-', 'hmac-md5-'] server mac:['hmac-md5', 'hmac-sha1', 'umac-@openssh.com', 'hmac-sha2-', 'hmac-sha2-', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-', 'hmac-md5-'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEB [-::23.627] thr= paramiko.transport: Kex agreed: diffie-hellman-group-exchange-sha256
DEB [-::23.627] thr= paramiko.transport: HostKey agreed: ssh-rsa
DEB [-::23.627] thr= paramiko.transport: Cipher agreed: aes128-ctr
DEB [-::23.628] thr= paramiko.transport: MAC agreed: hmac-sha2-
DEB [-::23.628] thr= paramiko.transport: Compression agreed: none
DEB [-::23.672] thr= paramiko.transport: Got server p ( bits)
DEB [-::23.741] thr= paramiko.transport: kex engine KexGexSHA256 specified hash_algo <built-in function openssl_sha256>
DEB [-::23.741] thr= paramiko.transport: Switch to new keys ...
DEB [-::23.782] thr= paramiko.transport: userauth is OK
INF [-::23.861] thr= paramiko.transport: Authentication (password) successful!
DEB [-::23.862] thr= paramiko.transport: [chan ] Max packet in: bytes
DEB [-::23.863] thr= paramiko.transport: [chan ] Max packet out: bytes
DEB [-::23.863] thr= paramiko.transport: Secsh channel opened.
DEB [-::23.864] thr= paramiko.transport: [chan ] Sesch channel request ok
DEB [-::23.868] thr= paramiko.transport: [chan ] EOF received ()

syslogin.log信息

三、paramiko的核心组件

paramiko包含两个核心组件,一个为SSHClient类,另一个为SFTPClient类。

SSHClient类

SSHClient类是SSH服务会话的高级表示,该类封装了传输(transport)、通道(channel)及SFTPClient的校验、建立的方法,通常用于执行远程命令。

client = SSHClient()
client.load_system_host_keys()
client.connect('ssh.example.com')
stdin, stdout,stderr = client.exec_command('ls -l')

SSHClient常用的方法介绍

官方文档:http://docs.paramiko.org/en/2.4/api/client.html?highlight=connect

connect方法

conect方法实现了远程SSH连接并校验

方法定义:

connect(hostname, port=, username=None, password=None, pkey=None, key_filename=None, timeout=None, allow_agent=True, look_for_keys=True, compress=False, sock=None, gss_auth=False, gss_kex=False, gss_deleg_creds=True, gss_host=None, banner_timeout=None, auth_timeout=None, gss_trust_dns=True, passphrase=None)

参数说明:

  • hostname(str类型),连接的目标主机地址;
  • port(int类型),连接目标主机的端口,默认为22;
  • username(str类型),校验的用户名(默认为当前的本地用户名);
  • password(str类型),密码用于身份校验或解锁私钥;
  • pkey(Pkey类型),私钥方式用于身份验证;
  • key_filename(str or list(str)类型),一个文件名或文件名列表,用于私钥的身份验证;
  • timeout(float类型),一个可选的超时时间(以秒为单位)的TCP连接;
  • allow_agent(bool类型),设置为False时用于禁用连接到SSH代理;
  • look_for_keys(bool类型),设置为False时用于来禁用在~/.ssh中搜索私钥文件;
  • compress(bool类型),设置为True时打开压缩。

exec_command方法

远程命令执行方法,该命令的输入与输出流为标准输入(stdin)、输出(stdout)、错误(stderr)的Python文件对像。

方法定义:

exec_command(command, bufsize=-, timeout=None, get_pty=False, environment=None)

参数说明:

  • command(str类型),执行的命令串;
  • bufsize(int类型),文件缓冲区大小,默认为-1(不限制)

load_system_host_keys方法

加载本地公钥校验文件,默认为~/.ssh/known_host,非默认路径需要手工指定。

方法定义:

load_system_host_keys(self,filename=None)

参数说明:

filename(str类型),指定远程主机公钥记录文件。

set_missing_host_policy方法

  设置连接的远程主机没有主机密钥或HostKeys对象时的策略,目前支持三种,分别是AutoAddPolicy、RejectPolicy(默认)、WarningPolicy,仅限用于SSHClient类。
  • AutoAddPolicy,目标添加主机名及主机密钥到本地HostKeys对象,并将其保存,不依赖load_system_host_keys()的配置,即使~/.ssh/hnown_hosts不存在也不产生影响;
  • RejectPolicy,自动拒绝未知的主机名和密钥,依赖load_system_host_keys()的配置;
  • WarningPolicy,用于记录一个未知的主机密钥的Python警告,并接收它,功能上AutoAddPolicy相似,但未知主机会有告警。

使用方法如下:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

SFTPClient类

  SFTPClient作为一个SFTP客户端对象,根据SSH传输协议的sftp会话,实现远程文件操作,比如文件上传、下载、权限、状态等操作。

SFTPClient类常用方法

官方文档:http://docs.paramiko.org/en/2.4/api/sftp.html

from_transport方法

创建一个已连通的SFTP客户端通道。

方法定义:

from_transport(cls,t)

参数说明:

t(transport),一个已通过验证的传输对象。

示例说明:

import paramiko

t = paramiko.Transport(('192.168.56.132',))
t.connect(username='root',password='')
sftp = paramiko.SFTPClient.from_transport(t)

put方法

上传本地文件到远程SFTP服务端

方法定义:

put(localpath, remotepath, callback=None, confirm=True)

参数说明:

  • localpath(str类型),需上传的本地文件(源);
  • remotepath(str类型),远程路径(目标);
  • callback(funcation(int,int)),获取已接收的字节数及总传输字节数,以便回调函数调用,默认为None;
  • confirm(bool类型),文件上传完毕后是否调用stat()方法,以便确认文件的大小。

示例说明:

localpath='/home/access.log'
remotepath='/data/logs/access.log'
sftp.put(localpath,remotepath)

get方法

从远程SFTP服务端下载文件到本地。

方法定义:

get(remotepath, localpath, callback=None)

参数说明:

  • remotepath(str类型),需要下载的远程文件(源);
  • callback(funcation(int,int)),获取已接收的字节数及总和传输字节数,以便回调函数调用,默认为None.

示例说明:

remotepath = '/data/logs/access.log'
localpath = '/home/access.log'
sftp.get(remotepath,localpath)

其它方法

SFTPClient类其它常用方法说明:

  • mkdir,在SFTP服务端创建目录,如sftp.mkdir("/home/userdir",mode=0777),默认模式是0777(八进制),在某些系统上,mode被忽略。在使用它的地方,当前的umask值首先被屏蔽掉。
  • remove,删除SFTP服务端指定目录,如sftp.remove("/home/userdir")。
  • rename,重命名SFTP服务端文件或目录,如sftp.rename("/home/test.sh","/home/testfile.sh")
  • stat,获取远程SFTP服务端指定文件信息,如sftp.stat("/home/testfile.sh")。
  • listdir,获取远程SFTP服务端指定目录列表,以Python的列表(List)形式返回,如sftp.listdir("/home")。

SFTPClient类应用示例

下面为SFTPClient类的一个完整示例,实现了文件上传、下载、创建与删除目录等,需要注意的是,put和get方法需要指定文件名,不能省略。

系统批量运维管理器paramiko详解的更多相关文章

  1. 系统批量运维管理器Fabric详解

    系统批量运维管理器Fabric详解 Fabrici 是基于python现实的SSH命令行工具,简化了SSH的应用程序部署及系统管理任务,它提供了系统基础的操作组件,可以实现本地或远程shell命令,包 ...

  2. 系统批量运维管理器pexpect详解

    一.pexpect介绍 pexpect可以理解成Linux下的expect的Python封装,通过pexpect我们可以实现对ssh.ftp.passwd.telnet等命令进行自动交互,而无需人工干 ...

  3. 系统批量运维管理器pexpect的使用

    # pip install pexpect 或 # easy_install pexpect 1 #!/usr/bin/env python 2 import pexpect 3 child = pe ...

  4. GridBagLayout布局管理器应用详解

    http://www.cnblogs.com/kungfupanda/p/7220217.html GridBagLayout布局管理器应用详解 很多情况下,我们已经不需要通过编写代码来实现一个应用程 ...

  5. 4.python 系统批量运维管理器之paramiko模块

    paramiko paramiko是ssh服务最经常使用的模块,遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接. paramiko实现ssh2不外乎两个角度:SSH客户端与服务端 SS ...

  6. PHPFastCGI进程管理器PHP-FPM详解

    PHP-FPM是一个PHPFastCGI进程管理器,是只用于PHP的.      PHP-FPM其实是PHP源代码的一个补丁,旨在将FastCGI进程管理整合进PHP包中.必须将它patch到你的PH ...

  7. JAVA中GridBagLayout布局管理器应用详解

    很多情况下,我们已经不需要通过编写代码来实现一个应用程序的图形界面,而是通过强大的IDE工具通过拖拽辅以简单的事件处理代码即可很轻松的完成.但是我们不得不面对这样操作存在的一些问题,有时候我们希望能够 ...

  8. 运维监控---企业级Zabbix详解_【all】

    基础LNMP环境搭建 Linux 下LNMP环境搭建 下载Zabbix 链接:https://pan.baidu.com/s/1n36esVyYAKstwnFopbV2sg 密码:izll 创建zab ...

  9. Python3自动化运维之Fabric模版详解

    一.概要 Fabric是基于Python(2.7,3.4+以上版本)实现的SSH命令行工具,简化了SSH的应用程序部署及系统管理任务,它提供了系统基础的操作组件,可以实现本地或远程shell命令,包括 ...

随机推荐

  1. spring-security-4 (1)介绍

    一.什么是spring security? spring security是基于spring开发的为JavaEE企业级应用提供安全服务的框架.安全服务主要是指 认证(Authentication)和  ...

  2. office 2013母版保存并调用

    如果觉得某个ppt的母版不错,想保存下来以后使用的话,那么执行 开始->另存为->  选择位置和格式,注意格式选择potx. 之后如果想要使用这组母版,怎么办呢? 浏览主题,打开之前保存的 ...

  3. mongodb下cpu高的查询方式(慢查询)

    1.查看mongodb进程 ps-ef | grep mongo 获取进程id为3267 2.查看进程的线程 top -p 3267 按shift+h 查看cpu高的线程,发现有线程点用cpu高且cp ...

  4. hibernate流程图

    流程图: 作者: IT程序狮 链接:http://www.imooc.com/article/1296来源:慕课网

  5. Linux中epoll+线程池实现高并发

    服务器并发模型通常可分为单线程和多线程模型,这里的线程通常是指“I/O线程”,即负责I/O操作,协调分配任务的“管理线程”,而实际的请求和任务通常交由所谓“工作者线程”处理.通常多线程模型下,每个线程 ...

  6. 10件在PHP7中不要做的事情

    10件在PHP7中不要做的事情 1. 不要使用mysql_函数 这一天终于来了,从此你不仅仅“不应该”使用mysql_函数.PHP 7 已经把它们从核心中全部移除了,也就是说你需要迁移到好得多的mys ...

  7. 【linux】mkdir -p命令

    如果要创建目录A并创建目录A的子目录B,没有用-p的情况下是mkdir 2次 如果用-p 可以直接创建2个目录 (迭代创建).mkdir -p 目录A/子目录B就可以

  8. SQL中減少日志文件大小

    SQL中減少日志文件大小   编写人:CC阿爸 2014-6-14 在日常SQL数据库的操作中,常常会出现SQL日志文件超大,大小都超过正常MDF数据库文件,作为一般用户来讲,LDF太大,只会影响服务 ...

  9. 1、hadoop HA分布式集群搭建

    概述 hadoop2中NameNode可以有多个(目前只支持2个).每一个都有相同的职能.一个是active状态的,一个是standby状态的.当集群运行时,只有active状态的NameNode是正 ...

  10. Erlang tool -- recon

    遇见recon 以来, 每次定位系统瓶颈, 总是能让我眼前一亮. 比如说, 定位非尾递归导致的内存暴涨, 定位引发CPU满载的进程.得心应手,每每额手称庆. recon 是ferd 大神 释出的一个 ...