SSDB 是一个 C/C++ 语言开发的高性能 NoSQL 数据库, 支持 zset(sorted set), map(hash), kv, list 等数据结构, 用来替代或者与 Redis 配合存储十亿级别的列表数据.
SSDB 同时也被国内外业界的众多互联网企业所使用, 如 QIHU 360, TOPGAME, 汽车之家, 比亚迪等.
SSDB 的主要特点:
支持 zset, map/hash, list, kv 数据结构, 可替代 Redis
特别适合存储大量集合数据, 支持丰富的数据结构: key-value, key-map, key-zset, key-list.
使用 Google LevelDB 作为存储引擎
支持主从同步, 多主同步
客户端支持 PHP, C++, Python, Lua, Java, Ruby, nodejs, Go 等
内存占用极少
图形化界面管理工具(phpssdbadmin主页:https://github.com/ssdb/phpssdbadmin)
phpssdbadmin的安装(windows版本):
1.安装nginx+php
2.下载phpssdbadmin并将其放到local目录(nginx.conf里local下的root目录)下,例如:
location / {
root html;
index index.html index.htm ;
}
这里的root就是表示和nginx.exe同级的html目录就是location的根目录
3.在nginx的配置文件(nginx.conf)中安装文档加入重定向和支持php解析功能
按照phpssdbadmin主页上的安装文档或phpssdnadmin下README安装,两者内容是一样的
4.安装完成:启动nginx,启动php,如果nginx启动失败,请到logs目录下查看error;
如果nginx的80端口被占用,可以改动nginx.conf中的port端口,那么访问是这样的:
localhost(nginx.conf中的server_name字段的值):端口号/phpssdbadmin
phpssdbadmin的安装(centos)
1.安装LNMP
yum install mysql
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm(这里选用的centos7,根据centos的版本来选装不同的rpm包)
yum -y install nginx
yum -y php-fpm
service php-fpm restart
service nginx restart
chkconfig php-fpm on
chkconfig nginx on
vim /etc/nginx/conf.d/default.conf (编辑nginx配置文件)
server {
listen 80;
server_name localhost;
autoindex on;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; (注意这里的fastcgi_script_name路径必须在php的根目录下)
include fastcgi_params; (这个文件和nginx.conf配置文件在同一级目录,如果不存在,请建一个)
}
fastcgi_params内容:
#fastcgi_params
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
#fastcgi_param REDIRECT_STATUS 200;
每改动一次配置请重启nginx
至此配置完成
附注:windows下nginx+php启动脚本(bat文件)内容:
@echo off
rem 当前bat的作用
echo ==================begin========================
cls
SET NGINX_PATH=c:
SET NGINX_DIR=c:\nginx-1.9.2\
color 0a
TITLE Nginx 管理程序 Power By Ants (http://leleroyn.cnblogs.com)
CLS
ECHO.
ECHO. * * Nginx 管理程序 Power By Ants (http://leleroyn.cnblogs.com) *
ECHO.
:MENU
ECHO. * nginx 进程list *
tasklist|findstr /i "nginx.exe"
ECHO.
ECHO. [1] 启动Nginx+php
ECHO. [2] 关闭Nginx+php
ECHO. [3] 重启Nginx+php
ECHO. [4] 退 出
ECHO.
ECHO.请输入选择项目的序号:
set /p ID=
IF "%id%"=="1" GOTO start
IF "%id%"=="2" GOTO stop
IF "%id%"=="3" GOTO restart
IF "%id%"=="4" EXIT
PAUSE
:start
call :startNginx
GOTO MENU
:stop
call :shutdownNginx
GOTO MENU
:restart
call :shutdownNginx
call :startNginx
GOTO MENU
:shutdownNginx
ECHO.
ECHO.关闭Nginx......
taskkill /F /IM nginx.exe > nul
ECHO.OK,关闭所有nginx 进程
ECHO.关闭php......
taskkill /F /IM php-cgi.exe > nul
ECHO.OK,关闭php进程
goto :eof
:startNginx
ECHO.
ECHO.启动Nginx......
IF NOT EXIST "%NGINX_DIR%nginx.exe" ECHO "%NGINX_DIR%nginx.exe"不存在
%NGINX_PATH%
cd "%NGINX_DIR%"
IF EXIST "%NGINX_DIR%nginx.exe" (
echo "start '' nginx.exe"
start "" nginx.exe
echo "start '' php-cgi.exe"
timeout /t 3
start d:/php5/php-cgi.exe -b 127.0.0.1:9000 d:php5/php.ni
)
ECHO.OK
goto :eof