• 欢迎访问运维搬运工网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 本站一年会员:100元 ,两年会员:180元 ,永久会员:380元
  • 这世界就是,一些人总在昼夜不停地运转,而另外一些人,起床就发现世界已经变了。
  • 本博客推广的是知识付费,用赞助的方式实现博客维护,不以赚钱为目的的博客

web可视化redis

python环境

系统默认2.7

注意:本段内容须“登录”后方可查看!

[root@iZj6cffp8anaguadrxuwx8Z ~]# python
Python 2.7.5 (default, Aug 4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information

安装mysql

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# yum -y remove mariadb-libs

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# yum -y install mysql mysql-devel mysql-server mysql-utilities

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# systemctl start mysqld.service

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# /usr/bin/mysql_secure_installation

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 'y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!


All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

设置权限

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# mysql -uroot -p123456 
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.6.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE DATABASE `redis_admin` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

安装依赖

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# yum install wget epel-release python-pip git vim blas-devel python2-devel lapack-devel gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel python3-devel libxml2 libxml2-devel libxslt libxslt-devel openssl gcc-c++

clone项目和虚拟环境依赖安装

[root@iZj6cffp8anaguadrxuwx8Z ~]# mkdir -p /data/wwwroot/ && cd /data/wwwroot


[root@iZj6cffp8anaguadrxuwx8Z wwwroot]# git clone https://github.com/cncentoscn/redis.git

[root@iZj6cffp8anaguadrxuwx8Z wwwroot]# cd redis && pip install -r requirements.txt

数据库配置

这个目录下面

[root@iZj6cffp8anaguadrxuwx8Z conf]# pwd
/data/wwwroot/redis/conf

数据库设置

[root@iZj6cffp8anaguadrxuwx8Z conf]# vim conf.py

database = {
"name": "redis_admin",
"host": "127.0.0.1",
"username": "root",
"password": "123456",
"port": "3306",
}

生成数据库表文件

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# python manage.py migrate
System check identified some issues:

WARNINGS:
users.DctUser.auths: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
Apply all migrations: auth, contenttypes, loginfo, sessions, users
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying loginfo.0001_initial... OK
Applying loginfo.0002_auto_20171019_1705... OK
Applying loginfo.0003_operationinfo_type... OK
Applying loginfo.0004_auto_20171019_2013... OK
Applying sessions.0001_initial... OK
Applying users.0001_initial... OK
Applying users.0002_auto_20180413_1539... OK
Applying users.0003_auto_20180413_1549... OK
Applying users.0004_auto_20180416_1636... OK
Applying users.0005_remove_redisconf_index... OK
Applying users.0006_auto_20180530_1753... OK
Applying users.0007_auto_20180530_1902... OK
Applying users.0008_redisconf_type... OK

创建管理用户

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# python manage.py createsuperuser
System check identified some issues:

WARNINGS:
users.DctUser.auths: (fields.W340) null has no effect on ManyToManyField.
Username: lucky
Email address: centoscn@aliyun.com
Password: 
Password (again): 
This password is entirely numeric.
Password: 
Password (again): 
Superuser created successfully.
[root@iZj6cffp8anaguadrxuwx8Z redis_admin]#

配置nginx

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# yum install -y nginx

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# cat /etc/nginx/conf.d/dd.conf
server {
listen 80;
server_name _;
access_log /data/wwwlogs/access_nginx.log combined;
index index.html index.htm index.php;
location / {
proxy_pass http://127.0.0.1:8000;
}
location /static {
expires 7d;
autoindex on;
add_header Cache-Control provate;
alias /data/wwwroot/redis_admin/static;
}
}

配置

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# mkdir -p /data/wwwlogs/
[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# touch /data/wwwlogs/access_nginx.log
[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# chmod 777 /data/wwwlogs/access_nginx.log
[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# nginx -t
nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# service nginx start

启动

[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# chmod +x start.sh
[root@iZj6cffp8anaguadrxuwx8Z redis_admin]# ./start.sh start
start [ successful ]

浏览器输入IP地址

添加redis

 


喜欢 (0)
[扫描二维码]
分享 (0)
大自然搬运工
关于作者:
不是路不平,而是你不行。到底行不行,看你停不停。只要你不停,早晚都能行。
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址