正确之后,浏览器打开localhost:8080,如果可访问 welcome to nginx 页面,表示配置完成。
2.3 常用命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# 通过help查看常用命令 /usr/local/nginx/sbin/nginx -h
Options: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configuration and exit -T : test configuration, dump it and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /usr/local/nginx/) -c filename : set configuration file (default: conf/nginx.conf) -g directives : set global directives out of configuration file
[root@bogon jdk1.8.0_101]# java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) [root@bogon jdk1.8.0_101]# javac Usage: javac <options><sourcefiles> where possible options include: -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info -nowarn Generate no warnings -verbose Output messages about what the compiler is doing -deprecation Output source locations where deprecated APIs are used -classpath <path> Specify where to find user class files and annotation processors -cp <path> Specify where to find user class files and annotation processors -sourcepath <path> Specify where to find input source files -bootclasspath <path> Override location of bootstrap class files -extdirs <dirs> Override location of installed extensions -endorseddirs <dirs> Override location of endorsed standards path -proc:{none,only} Control whether annotation processing and/or compilation is done. -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process -processorpath <path> Specify where to find annotation processors -parameters Generate metadata for reflection on method parameters -d <directory> Specify where to place generated class files -s <directory> Specify where to place generated source files -h <directory> Specify where to place generated native header files -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files -encoding <encoding> Specify character encoding used by source files -source <release> Provide source compatibility with specified release -target <release> Generate class files for specific VM version -profile <profile> Check that API used is available in the specified profile -version Version information -help Print a synopsis of standard options -Akey[=value] Options to pass to annotation processors -X Print a synopsis of nonstandard options -J<flag> Pass <flag> directly to the runtime system -Werror Terminate compilation if warnings occur @<filename> Read options and filenames from file
mysql > grant replication slave on *.* to webadmin@'172.17.22.51.%' identified by 'def_passwd'; mysql > show master status\G
从服务器上配置连接主服务器 (重启mysql,不需要每次都执行一次,仅执行一次即可)
1 2 3 4 5 6 7 8 9 10 11 12 13
# mysql -uroot -p Enter password: mysql > stop slave; mysql >change master to master_host='172.17.22.50', master_port=3306, master_user='webadmin', master_password='def_passwd', master_log_file='mysql1-bin.000008', master_log_pos=454; mysql > start slave; mysql > show slave status\G
验证
主服务器上创建数据库、表、并插入数据
1 2 3 4 5 6 7 8 9 10
mysql > CREATE DATABASE test_ab default charset utf8; mysql > CREATE TABLE test_ab.a1(id int(2),name varchar(20)); mysql > INSERT INTO test_ab.a1(id,name) VALUES(1,"测试1"); mysql> select * from test_ab.a1; +------+---------+ | id | name | +------+---------+ | 1 | 测试1 | +------+---------+ 1 row in set (0.00 sec)
从服务器上查询该数据,验证是否复制过来
1 2 3 4 5 6 7
mysql> select * from test; +------+---------+ | id | name | +------+---------+ | 1 | 测试1 | +------+---------+ 1 row in set (0.00 sec)
$ cd /usr/local/ $ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz $ tar -zxvf pcre-8.36.tar.gz $ cd pcre-8.36 $ ./configure $ make $ make install
2.安装zlib库
1 2 3 4 5 6 7
$ cd /usr/local/ $ wget http://zlib.net/zlib-1.2.8.tar.gz $ tar -zxvf zlib-1.2.8.tar.gz $ cd zlib-1.2.8 $ ./configure $ make $ make install
3.安装ssl
1 2 3 4 5 6
$ cd /usr/local/ $ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz $ tar -zxvf openssl-1.0.1j.tar.gz $ ./config $ make $ make install
4.安装nginx
1 2 3 4 5 6 7 8 9 10
$ cd /usr/local/ $ wget http://nginx.org/download/nginx-1.8.0.tar.gz $ tar -zxvf nginx-1.8.0.tar.gz $ cd nginx-1.8.0 $ ./configure --prefix=/usr/local/nginx (用下面的)
upstream myserver; { ip_hash; server 172.16.1.1:8001; server 172.16.1.2:8002; server 172.16.1.3; server 172.16.1.4; } location / { proxy_pass http://myserver; }
#下载4.0稳定版 wget http://download.redis.io/releases/redis-4.0.11.tar.gz #解压到用户主目录 tar -xzvf redis-4.0.11.tar.gz -C /home/wx #进入用户主目录 cd /home/wx #重命名解压的文件 mv redis-4.0.11 redis #进入redis目录 cd redis #编译 make #安装,PREFIX指定安装路径 make PREFIX=/home/wx/redis install