Linux命令介绍: vi
命令描述:文件编辑命令。
重要程度:***
vi 是Linux下最为强大的文本编辑命令之一。其强大的功能来源于其种类繁多的命令。是office办公中Linux环境下常用命令之一。
主要参数说明:
虽然vi命令有许多的参数。但其实用的多不外乎以下几个,其他的命令虽然可以实现更加复杂的编辑功能,但那种情况下不如在windows下编辑好了上传到Linux来的方便。
i :插入模式。顾名思义,按了i以后就可以对文本内容进行添加删除等编辑了。
dd :删除整行
ESC :退回命令模式
w :保存
q :退出
q!:强制退出。当错误的编辑了文件时想退出重新编辑时用
其他参数建议参阅蘑菇帖子里的vi命令png。
由此我们知道,当我们通过装有Linux本机的系统登录并进入Mysql时,Mysql会以你在Linux登录时的用户名登录并没有口令.但是当你在windows添加用户名jira时,默认是不从localhost登录的.也就是说这个用户并不能通过Linux本机登录。所以当我们在"add host from which the user can connect"中选择了Linux本机时,上述命令就可以测试通过了。
-----------------------------------------
八:Apache实验课后练习:Apache加Tomcat的配置
配置Tomcat前需要做一些准备工作。首先下载Tomcat5.5.9即jakarta-tomcat-5.5.9.tar.gz文件,Mod_jk 1.2.14即jakarta-tomcat-connectors-1.2.14-src.tar.gz文件。这里Mod_jk是Tomcat-Apache插件,为Apache和Tomcat的连接器,处理Tomcat和Apache之间的通信,在集群配置中充当负载均衡器的作用,当前的最新版本为1.2.15。在确保了机器上已经安装有apache和java虚拟机以后,做如下配置。首先安装Tomcat,再安装Mod_jk,最后进行Tomcat和Apache的整合:
Tomcat安装:
# cd /usr/local/
# tar xvfz jakarta-tomcat-5.5.9.tar.gz
# mv /usr/local/jakarta-tomcat-5.5.9 /usr/local/tomcat
# vi /usr/local/tomcat/bin/catalina.sh
第46行加入此句
JAVA_HOME=/usr/java/j2sdk1.4.2_10
启动服务
# /usr/local/tomcat/bin/startup.sh /startup.bat
关闭服务
# /usr/local/tomcat/bin/shutdown.sh /shutdown.bat
安装JK
# cd /usr/local/
# tar xzvf jakarta-tomcat-connectors-1.2.14-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.14-src/jk/native
# chmod 755 buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
# cd /usr/local/jakarta-tomcat-connectors-jk1.2.14-src/jk/native/apache-2.0/
# cp mod_jk.so /usr/local/apache/modules/
系统整合
# vi /usr/local/apache/conf/httpd.conf
在文件最末尾加上如下语句
#Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /*.jsp loadbalancer
JkMount /servlet/* loadbalancer
JkMount /application/* loadbalancer
#vi /usr/local/apache/conf/workers.properties
添加下列语句
#
# workers.properties
#
# In Unix, we use forward slashes:
ps=/
# list the workers by name
worker.list=tomcat1, tomcat2, loadbalancer
# ------------------------
# First tomcat server
# ------------------------
worker.tomcat1.port=8009
worker.tomcat1.host=127.0.0.1
worker.tomcat1.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100
# ------------------------
# Second tomcat server
# ------------------------
worker.tomcat2.port=8009
worker.tomcat2.host=192.168.1.34
worker.tomcat2.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat2.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat2.lbfactor=100
# ------------------------
# Load Balancer worker
# ------------------------
# The loadbalancer (type lb) worker performs weighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# worker.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1, tomcat2
#
# END workers.properties
#
#vi /usr/local/tomcat/conf/server.xml
<Connector port="8009"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443" protocol="AJP/1.3" /> 第101行
在119行左右加入如下语句(去注释)