rtyug

rtyug
Рейтинг
263
Регистрация
13.05.2009
Должность
perl,php,sql,javascript(jquery),freebsd/linux
Интересы
perl,php,sql,javascript(jquery),freebsd/linux
https://minfin.com.ua/blogs/94589307/115366/
Himiko:
Хардов нужно много для скорости, а не для количества места на диске....
Может кто чего предложит "быстрое"?

вы хотите файлы хранить?

почему бы не взять распределенную систему с репликацией?

реплицировать на несколько серверов и прикрутить туда nginx?

или разработвать свою систему, на perl в 10 раз быстрее :)

http://code.google.com/p/mogilefs/wiki/HighLevelOverview

http://www.opennet.ru/prog/info/2620.shtml

http://www.danga.com/mogilefs/

About MogileFS

MogileFS is our open source distributed filesystem. Its properties and features include:
Application level -- no special kernel modules required.
No single point of failure -- all three components of a MogileFS setup (storage nodes, trackers, and the tracker's database(s)) can be run on multiple machines, so there's no single point of failure. (you can run trackers on the same machines as storage nodes, too, so you don't need 4 machines...) A minimum of 2 machines is recommended.
Automatic file replication -- files, based on their "class", are automatically replicated between enough different storage nodes as to satisfy the minimum replica count as requested by their class. For instance, for a photo hosting site you can make original JPEGs have a minimum replica count of 3, but thumbnails and scaled versions only have a replica count of 1 or 2. If you lose the only copy of a thumbnail, the application can just rebuild it. In this way, MogileFS (without RAID) can save money on disks that would otherwise be storing multiple copies of data unnecessarily.
"Better than RAID" -- in a non-SAN RAID setup, the disks are redundant, but the host isn't. If you lose the entire machine, the files are inaccessible. MogileFS replicates the files between devices which are on different hosts, so files are always available.
Flat Namespace -- Files are identified by named keys in a flat, global namespace. You can create as many namespaces as you'd like, so multiple applications with potentially conflicting keys can run on the same MogileFS installation.
Shared-Nothing -- MogileFS doesn't depend on a pricey SAN with shared disks. Every machine maintains its own local disks.
No RAID required -- Local disks on MogileFS storage nodes can be in a RAID, or not. It's cheaper not to, as RAID doesn't buy you any safety that MogileFS doesn't already provide.
Local filesystem agnostic -- Local disks on MogileFS storage nodes can be formatted with your filesystem of choice (ext3, XFS, etc..). MogileFS does its own internal directory hashing so it doesn't hit filesystem limits such as "max files per directory" or "max directories per directory". Use what you're comfortable with.
Enygma:
Software error:

Can't execute select:
The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay at Modules/DataBase.pm line 81.
...

надо добавить

 $db->Exec('SET SQL_BIG_SELECTS=1');
APC
debrain:
APC

ху из ху?

PHP APC Extensions?

можно ли сделать на подобе сайта 2spb.ru за ~150$?? (без дизайна)

(закасчик мне заказывал давно, но не было времени сделать)

в логах nginx такая строка:

2010/11/25 05:59:43 [error] 19835#0: *1 could not find named location "http://www.x0.org.ua/to_nginx?bs=$body_bytes_sent" while sending response to cl$

2010/11/25 06:27:33 [error] 19835#0: *2 could not find named location "http://www.x0.org.ua/to_nginx?bs=$body_bytes_sent" while sending response to cl$

он не может отправить запрос на другой сервер (доменое имя) ?

rtyug добавил 25.11.2010 в 17:36

Andreyka:
uplaod в nginx собран?

видимо, нет

/nginx -V

nginx version: nginx/0.8.48
built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42)
configure arguments: --with-http_perl_module --with-http_stub_status_module

для того чтобы он отправил запрос надо собрать с uplaod?

rtyug добавил 25.11.2010 в 19:59

вродебы разобрался

# Premium

location /download_p/ {
alias /home/files/cgi-bin/uploads/;
internal;
#set $limit_rate 500k;
limit_conn one 50;

set $postURI $uri;
set $postIP $remote_addr;
set $postHOST $host;


post_action @postDownload;
}


location @postDownload {
proxy_pass http://193.201.81.40/to_nginx?bs=$body_bytes_sent&domain=$postHOST&uri=$postURI;
proxy_set_header X-Real-IP $postIP;
proxy_set_header BytesSent $body_bytes_sent;
}

запрос не хочет отправятся...

я добавил строку

  post_action http://www.site.com/to_nginx?bs=$body_bytes_sent;

в полностью рабочий конфиг

 # Free                                                                  

location /download_f/ {
alias /home/file/cgi-bin/uploads/;
internal;
set $limit_rate 40k;

limit_conn one 1;

post_action http://www.site.com/to_nginx?bs=$body_bytes_sent;

}

# Registered
location /download_r/ {
alias /home/files/cgi-bin/uploads/;
internal;
set $limit_rate 40k;
limit_conn one 1;
post_action http://www.site.com/to_nginx?bs=$body_bytes_sent;

}

# Premium
location /download_p/ {
alias /home/file/cgi-bin/uploads/;
internal;
#set $limit_rate 500k;
limit_conn one 50;
post_action http://www.site.com/to_nginx?bs=$body_bytes_sent;
}

но запрос НЕ отправился после того как я скачал файл, в логах apache на http://www.site.com/ в error и access нету запроса

Товарищи, подскажите есть:

post_action

location ~* ^/media/.+\.(mp3|wma|ogg|ape|flac)$ {

post_action /counter.php?bs=$body_bytes_sent;
}

кроме $body_bytes_sent, как отправить после того как клиент скачет что-то одно из:

1) хеш который был прислан для разрешения скачивания файла (чтобы идентифицировать скачивание и файл пользователя)

2) или имя отдаваемого файла, но лучше п.1

где это найти?

Detektiv, можно сделать, я участвовал в разработке и поддержке одной из крупнейшей банерской сети в западном сементе, можно сделать на основе этой...

там еще есть perl модуль perl_require download.pm;

package download;                                                                                                                                            

use strict;
use nginx;
use Crypt::HCE_MD5;

my $dl_key = "re2lgr5";
my $upload_dir="/home/file/cgi-bin/uploads";

sub handler {
my $r = shift;

my $hce = Crypt::HCE_MD5->new($dl_key,"XFile");
($_) = $r->filename=~/\/(\w+)\/[^\/]+$/;
my $l;
tr|a-z2-7|\0-\37|;
$_=unpack('B*',$_);
s/000(.....)/$1/g;
$l=length;
$_=substr($_,0,$l & ~7) if $l & 7;
$_=pack('B*',$_);

my ($srv_id,$file_id,$usr_id,$dx,$id,$dmode,$i1,$i2,$i3,$i4,$expire) = unpack("SLLSA12AC4L", $hce->hce_block_decrypt($_) );
$dx=sprintf("%05d",$dx);

if($r->remote_addr !~ /^$i1\.$i2\./)
{
$r->internal_redirect("/error_wrong_ip.html");
}
elsif($expire<time)
{
$r->internal_redirect("/error_expired.html");
}
elsif(!-f "$upload_dir/$dx/$id")
{
$r->internal_redirect("/error_nofile.html");
}
else
{
$r->header_out("Content-Disposition","attachment");
$r->internal_redirect("/download_$dmode/$dx/$id?id=$file_id&usr=$usr_id".$r->args);
}

return OK;
}

1;
Boris A Dolgov:
Покажите Ваш конфиг, тонче его часть, ответственную за скачивание.

вродебы это оно:

                                                                               

#user nobody;
worker_processes 8;
worker_rlimit_nofile 10240;
worker_rlimit_sigpending 32768;

error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 2048;
}


http {
include mime.types;
default_type application/octet-stream;

access_log logs/access.log combined;

access_log logs/access.log combined;

#sendfile on;
#tcp_nopush on;
reset_timedout_connection on;

server_tokens off;
autoindex off;

keepalive_timeout 0;
#keepalive_timeout 65;

limit_zone one $binary_remote_addr 10m;
perl_modules perl;
perl_require download.pm;

server {
listen 182;
server_name localhost;
proxy_set_header X-Real-IP $remote_addr;

#charset koi8-r;

location /nstatus {
stub_status on;
#allow 127.0.0.1;
#deny all;
}

location / {
root html;
index index.html index.htm;
}

location /d/ {
perl download::handler;
}

# Free
location /download_f/ {
alias /home/file/cgi-bin/uploads/;
internal;
set $limit_rate 40k;

limit_conn one 1;
}

# Registered
location /download_r/ {
alias /home/files/cgi-bin/uploads/;
internal;
set $limit_rate 40k;
limit_conn one 1;
}

# Premium
location /download_p/ {
alias /home/file/cgi-bin/uploads/;
internal;
#set $limit_rate 500k;
limit_conn one 50;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}

}

там еще есть perl модуль perl_require download.pm;

Всего: 2055