<span id="Label3"></p><p><p><span style="font-family:‘微软雅黑‘, ‘Microsoft YaHei‘;">1. Preparing the development environment</span></p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">Yum groupinstall-y "development Tools" "Server Platform development"</pre></pre><p><p>2. Update Time</p></p><p><p>3. Download redis-3.2.1.tar.gz, website address is: Www.redis.io<br></p></p><p><p>4. Compiling the installation</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">Tar XF redis-3.2.1.tar.gzcd redis-3.2.1make</pre></pre><p><p>Start the Redis service, the default port number is 6379</p></p><p><p>Note: sometimes because of the different Redis profile, we need to specify the configuration file when we start the service profile, not the default profile</p></p><p><p>Switch directories to the source package file</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">[email protected] src]# pwd/root/redis-3.2.1/src[[email protected] src]# redis-server./... /redis.conf</pre></pre><p><p>See if services are turned on</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">[email protected] src]# NETSTAT-TUNLP | grep 6379tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 1387/redis-server 0</pre></pre><p><p>Enter Interactive commands</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">[email protected] src]# redis-cli-p 6379127.0.0.1:6379></pre></pre><p><p>Configure a Master-slave server, master/slave in fact, the configuration is identical, so simple point to directly clone the server just configured</p></p><p><p>The IP address of the server just now is 192.168.1.104</p></p><p><p>The cloned IP address is 192.168.1.107, as a slave server</p></p><p><p>Edit the configuration file/root/redis-3.2.1/redis.conf for the slave server and modify the following related parameters</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">Bind 0.0.0.0daemonize yesslaveof 192.168.1.104 6379</pre></pre><p><p>After saving, turn on Redis service</p></p><p><p>Go back to 192.168.1.104 's master host for testing</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">[email protected] src]# redis-cli-p 6379127.0.0.1:6379> info# replicationrole:masterconnected_slaves:1slave0:ip= 192.168.1.107,port=6379,state=online,offset=631,lag=1master_repl_offset:631repl_backlog_active:1repl_backlog_ size:1048576repl_backlog_first_byte_offset:2repl_backlog_histlen:630</pre></pre><p><p>Test on 192.168.1.107 's slave host</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">[email protected] src]# redis-cli-p 6379127.0.0.1:6379> info# replicationrole:slavemaster_host : 192.168.1.104master_port:6379master_link_status:up-------> Connection Successful MASTER_LAST_IO_SECONDS_AGO:7MASTER_SYNC_ in_progress:0slave_repl_offset:617slave_priority:100slave_read_only:1connected_slaves:0master_repl_offset:0 repl_backlog_active:0repl_backlog_size:1048576repl_backlog_first_byte_offset:0repl_backlog_histlen:0</pre></pre><p><p>The master server is writable, for example</p></p><p><p>On the 192.168.1.104master</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">127.0.0.1:6379> set today 1ok127.0.0.1:6379> get today "1" 127.0.0.1:6379></pre></pre><p><p>On the 192.168.1.107slave</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">127.0.0.1:6379> Get today "1" 127.0.0.1:6379></pre></pre><p><p>Test the use of the lamp environment below</p></p><p><p>Preparation Environment:</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">Yum install-y Apr apr-util httpd php php-devel php-mysql mariadb mariadb-server</pre></pre><p><p>Lamp Host for 192.168.1.106<br></p></p><p><p>Install the Phpredis extension,</p></p><p><p>:<span style="color:rgb(51,51,51);font-family:‘Microsoft Yahei‘, ‘微软雅黑‘, arial, ‘宋体‘, sans-serif;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:28px;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;background-color:rgb(255,255,255);">wget https://github.com/phpredis/phpredis/archive/2.2.7.tar.gz<br></span></p></p><p><p>You need to generate a configuration file to enter Phpredis after decompression, so execute <span style="color:rgb(255,0,0);">phpize</span></p></p><p><p><span style="color:rgb(255,0,0);"><span style="color:rgb(0,0,0);">Configuring the compilation Installation</span></span></p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">./configure--with-php-config=/usr/bin/php-config--enable-redismakemake Install</pre></pre><p><p><span style="color:rgb(255,0,0);"><span style="color:rgb(0,0,0);"></span><br></span>Configuring PHP Load Extensions</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">Vim/etc/php.ini add extension=redis.so at extension place</pre></pre><p><p>Add a home page under the Web root (note add directoryindex index.php in Httpd.conf)</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">cat/var/www/html/index.php<?php Phpinfo ();? ></pre></pre><p><p>See if there is an extension in the browser</p></p><p><p><br></p></p><p><p>650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/83/51/wKioL1dwuBrikJByAABvXPTvqy4326.jpg "title=" redis.so "alt=" wkiol1dwubrikjbyaabvxptvqy4326.jpg "/></p></p><p><p>Verify that PHP is able to use Redis</p></p><p><p>Create a folder under the root directory for Redis</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">mkdir rediscat redis/test.php<?php $redis =new redis (); $redis->connect (' 192.168.1.104 ', ' 6379 '); $redis->set (' name ', ' Xuelong '); echo $redis->get (' name ');? ></pre></pre><p><p>View http://192.168.1.106/redis/test.php<br></p></p><p><p>650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/83/52/wKiom1dwuXvTupq0AAAW8jmbKu4525.jpg "title=" PHP Test Redis Service Connection "alt=" wkiom1dwuxvtupq0aaaw8jmbku4525.jpg "/><br></p></p><p><p>Phpredisadmin Background Management configuration</p></p><p><p>:<span style="color:rgb(51,51,51);font-family:‘Microsoft Yahei‘, ‘微软雅黑‘, arial, ‘宋体‘, sans-serif;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:28px;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;background-color:rgb(255,255,255);">wget </span>https://github.com/ErikDubbelboer/phpRedisAdmin/archive/v1.1.0.tar.gz<br></p></p><p><p>Download and unzip to the web directory to enter the phpRedisAdmin-1.1.0 directory</p></p><p><p>To clone a file to phpRedisAdmin-1.1.0, the command is:</p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false">git clone https://github.com/nrk/predis.git Vendor</pre></pre><p><p>The configuration file that configures the connection server address is <span style="color:rgb(51,51,51);font-family:‘Microsoft Yahei‘, ‘微软雅黑‘, arial, ‘宋体‘, sans-serif;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:28px;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;background-color:rgb(255,255,255);">phpredisadmin-1.1.0/includes/config.sample.inc.php, so back up the file with the same name as config.inc.php</span></p></p><p><p><span style="color:rgb(51,51,51);font-family:‘Microsoft Yahei‘, ‘微软雅黑‘, arial, ‘宋体‘, sans-serif;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:28px;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;background-color:rgb(255,255,255);">Modify the configuration file To:</span></p></p><pre class="brush:bash;toolbar:false"><pre class="brush:bash;toolbar:false"> array ( ' name ' => ' Remote server ', // ---> own name . ' host ' => ' 192.168.1.104 ', --->redis server address ' Port ' => 6379, ---> Port number ' filter ' = > ' * ' // Optional Redis authentication. //' auth ' => ' redispasswordhere ' // Warning: The password is sent in plain-text to the redis server. ), </pre></pre><p><p><span style="color:rgb(51,51,51);font-family:‘Microsoft Yahei‘, ‘微软雅黑‘, arial, ‘宋体‘, sans-serif;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:28px;text-align:justify;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;background-color:rgb(255,255,255);"></span>650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/83/53/wKiom1dwu3iSEL8fAABcKcFChh0175.jpg "title=" Phpredisadmin "alt=" wkiom1dwu3isel8faabckcfchh0175.jpg "/></p></p><p><p><strong><span style="font-size:20px;">Author:xuelong</span></strong></p></p><p><p><strong><span style="font-size:20px;">qq:1451032707</span></strong></p></p><p><p><strong><span style="font-size:20px;"></span></strong><br></p></p><p><p><br></p></p><p><p>This article is from the "Touch Dream" blog, so be sure to keep this source http://xuelong.blog.51cto.com/10573089/1793251</p></p><p><p>Redis Configuration-master Server-phpredis-phpredisadmin</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service