+ Responder ao Tópico



  1. #1

    Post Tudo sobre o novo ThunderCache 2.2

    Então pessoal, lançado o novo ThunderCache 2.2, por enquanto segue o link, maiores informações serão postadas conforme forem divulgadas pelos autores.

    Tentaremos fazer deste tópico um facilitador para o upgrade dos sistemas ThunderCache 2.1 atualmente instalados, se precisar de ajuda para a configuração seja claro onde esta sua dificuldade e faremos o possível para ajudá-lo desde que respeite as regras e faça uma boa busca no fórum antes de perguntar.


    http://img515.imageshack.us/img515/9917/conlinux.png

    1 - Incompatibilidade com os plugins da versão 2.1 e vice versa, sendo portanto necessário um upgrade total.

    Download da versão atual:
    http://189.75.242.85/thunder-v2.2.tar.bz2


    Descompacte o conteúdo do thunder22 na pasta /etc/squid

    wget http://189.75.242.85/thunder-v2.2.tar.bz2 #para baixar

    tar -xvf thunder-v2.2.tar.bz2 #para descompactar, note que sera criada uma pasta, nela estão os arquivos novos, faça backup dos antigos antes de continuar


    No squid.conf ao final
    Código :
    url_rewrite_children 200 
    acl store_rewrite_list url_regex -i "/etc/squid/thunder.lst"
    url_rewrite_access allow store_rewrite_list 
    url_rewrite_access deny all 
    url_rewrite_program /etc/squid/loader.php  
    acl localcache dstdomain 192.168.10.250 # < ip do servidor linux
    cache deny localcache

    No thunder.lst
    Código :
    http.*\.4shared\.com.*(\.exe|\.iso|\.torrent|\.zip|\.rar|\.pdf|\.doc|\.tar|\.mp3|\.mp4|\.avi|\.wmv)
    http.*\.avast\.com.*(\.def|\.vpu|\.vpaa|\.stamp)
    http.*(\.avg\.com|\.grisoft\.com).*(\.bin|\.exe)
    http.*(\.avgate\.com|\.avgate\.net|\.freeav\.net).*(\.dll\.gz|\.vdf\.gz)
    http.*flashvideo\.globo\.com.*(\.mp4|\.flv)
    http.*\.googlevideo\.com.*videoplayback
    http.*fpatch\.grandchase\.com\.br.*(\.kom|\.mkom|\.mp3)
    http.*(\.kaspersky-labs\.com|\.geo\.kaspersky\.com).*\.avc
    #http.*\storage\.mais\.uol\.com\.br.*\.flv
    #http.*\.orkut\.com.*\.jpg
    http.*\.pornhub\.com.*\.flv
    http.*\.redtube\.com\/_videos.*flv
    http.*\.terra\.com.*\.flv
    http.*media[a-z0-9]{2}\.tube8\.com.*.*\.flv
    http.*(\.windowsupdate\.com|\.microsoft\.com).*(\.cab|\.exe)
    http.*\.xvideos\.com.*\.flv
    http.*\.youtube\.com.*videoplayback
    http.*\.ytimg\.com.*watch_header\.jpg
    No thunder.conf:
    Código :
    <?php
            $cache_dir      =       "/var/www/thunder";
            $disk_max       =       98; // percent
            $disk_ok        =       90; //percents when clear cache
            $cache_scr      =       "/etc/squid";
            $server_ip      =       "192.168.10.250"; // < ip do servidor linux
            $cache_url      =       "http://$server_ip/thunder";
            $logadd_on      =       false;
            $proxy_host     =       ""; // keep it empty if you dont need proxy
            $proxy_port     =       "3128";
            $redir          =       ""; //não utilizado
            $download_speed =       512; // kbytes
            $max_downloaders = 2; // limite de dois downloads por dominio para cada ip requisitante (cliente)
     
            // advanced params - IF YOU DONT KNOW, DONT TOUCH!
            $download_timeout       =       10;
            $packet_size            =       500;    // in bytes
            $packet_delay           =       2000;// time in micro second
     
    ?>
    No youtube.com.php usar o publicado pelo osmano em thundercache.org:
    Código PHP:
    <?php
    /** 
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    *
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU Library General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with this program; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    *
    * (C) Copyright 2008-2009 Thunder Cache
    *
    * For more information check http://thundercache.org
    *
    * Plugin youtube.com
    * Cache flash video files from youtube and googlevideo
    * Need to put ".youtube.com" in squid.conf in line "acl store_rewrite_list dstdomain"
    * best if you create symbolic link named "googlevideo.com.php" and put in squid.conf ".googlevideo.com"
    *
    * @author rodrigo manga <[email protected]>
    */ 
    // confs
    $save_quality false;
    $domain "youtube";

    if (!
    function_exists('get_videoid')){
       function 
    get_videoid($url) {
          
    $return "";
          
    $url preg_replace("/\?/","&",$url);
          
    $url explode("/",$url);
          
    $url $url[3];
          
    $url explode("&",$url);
          
          foreach (
    $url as $valor){
             
    $valor explode("=",$valor);
             if (
    $valor[0] == "id" || $valor[0] == "video_id") {
                
    $return $valor[1];
                break;
             }
          }
          return 
    $return;
       }
    }
    if (!
    function_exists('get_quality')){
       function 
    get_quality($url) {
          
    $return "";
          
    $url preg_replace("/\?/","&",$url);
          
    $url explode("/",$url);
          
    $url $url[3];
          
    $url explode("&",$url);
          
          foreach (
    $url as $valor){
             
    $valor explode("=",$valor);
             if (
    $valor[0] == "fmt") {
                
    $return $valor[1];
                break;
             }
          }
          return 
    $return;
       }
    }

    logadd("IN:($ip)$url");

    if ( ( (
    strrpos($url,".googlevideo.com/") !== false) or (strrpos($url,".youtube.com/") !== false) ) and
       ( (
    strrpos($url,"/get_video?") !== false) or (strrpos($url,"/videoplayback?") !== false) ) and
       ( (
    strrpos($url,"id=") !== false) or (strrpos($url,"video_id=") !== false) ) and 
       (
    strrpos($url,"begin=") === false )

    ){
       
    // get  videoid
       
    $videoid get_videoid($url);

       
    // get quality
       
    if ($save_quality) {
          
    $file=get_quality($url)."$videoid.flv";
       }else{
          
    $file="$videoid.flv";
       }
         
    // check if url need to pass

       
    if ($file != ".flv") {
          
    check_file($file,$url,$domain,$ip);
       } else { 
    // dont find file, repass url
          
    print "$url\n";
          
    logadd("OUT:$url (file empty: $file)");
       }
    } else {
       
    // url not match
       
    print "$url\n";
       
    logadd("OUT:$url (dont match)");
    }
      
    ?>
    No loader.php seguir a dica do osmano da página 5 em thundercache.org:
    Código :
    de:
    if (file_exists("$cache_scr/plugins/$domain")) {
                            include("$cache_scr/plugins/$domain");
     
    para:
    if (file_exists("$cache_scr/$domain")) {
                            include("$cache_scr/$domain");
    Utilizar o seguinte comando para trocar as permissões dos arquivos php
    Código :
    chmod a+x /etc/squid/*.php
    Recarregar o squid com as alterações
    Código :
    squid -k reconfigure
    Feito, com isso estara funcionando o thunder 2.2 no seu servidor


    Grande abraço a todos, parabéns osmano pelas dicas, agora rodando Thunder 2.2 com limite de 2 videos para cada cliente (ip requisitante), recomendo a leitura do tópico no fórum do thundercache.org para melhor compreensão, obrigado Rodrigo Manga por ter compartilhado mais esta melhoria para o ThunderCache, Biazus por encabeçar o projeto e muito obrigado a todos os desenvolvedores que trabalham incansavelmente no aperfeiçoamento desta ferramenta.


    E quando for lançado o ThunderCache 3, 4, 5, estaremos por aqui divulgando maneiras de facilitar a vida das pessoas, por enquanto a versão mais atualizada é a publicada acima. Este provavelmente seja uma versão intermediaria para o ThunderCache 3 em C.

  2. #2

    Padrão

    o thunder 2.2 nao funcionou aqui, igual aos amigos la do forum do thunder, tudo instalado o squid funciona normal mas o thunder 2.2 nao faz cache. estou fasendo alguns testes alguma novidade posto.

  3. #3

    Padrão Nada de Cache!

    Testei aqui e também não fez cache,

    Bom estamos no aguardo o Manga pediu um poquinho de paciência.

    Quem quiser acompanhar no forum do Thunder . ThunderCache 2.2.

    Boa noite a Todos!

  4. #4

    Padrão

    Realmente não ta rodando 100%, vamos aguardar os ajustes ........ a equipe ta de parabéns.

  5. #5

    Padrão

    Pessoal, parece que estão tendo problemas com o lançamento da release 2.2, enquanto aguardam o lançamento dessa release que promete, já podem ir atualizando um novo controle de downloads simultâneos que foi proposto pelo amigo osmano lá no fórum do thunder, segue o link para download, basta adicionar 2 variáveis no thunder.conf e substituir os arquivos functions.php e downloader.php.

    Segue texto original do osmano807
    Olha, só, fiz este "patch" para não consumir muita internet (o $download_speed funciona com umas modificações, mas mesmo assim consumia tudo). Ele pega a config $max_concurrent_downloads do thunder.conf, e se já passou do limite, manda a url original pro squid.

    Basicamente, ele limita os downloads simultaneos até o limite definido no $max_concurrent_downloads.
    Ainda há alguns bugs, como várias pessoas acessando o mesmo vídeo ao mesmo tempo, só a primeira vai pegar via stream, as outras vão pegar do servidor. Mas se o arquivo já estiver no hd, vai dar hit normal.

    Fiz o upload em um tar.gz para facilitar (junto com meu thunder.conf). Subistituir o functions.php e o downloader.php. Olhar o thunder.conf e adicionar as linhas $max_concurrent_downloads e $down_lock como as suas necessidades.
    Como recomendável, faça um backup desses arquivo no caso de não funcionar.

    Ah, minha função logadd grava em um arquivo, no caso /var/log/thunder.log. Se não quiserem, é só voltar para a função antiga.

    Download do limitador de simultâneos
    Lembrem de fazer backup dos arquivos antes de substituir, pra mim foi tranquilo esta funcionando perfeitamente bem este novo update. Parabéns osmano pela contribuição, tenho certeza que muitos aqui apreciarão.

  6. #6

    Lightbulb

    Resolvido, agora rodando ThunderCache 2.2, pra quem quiser só seguir os passos da primeira mensagem deste post.

    Abraço e obrigado a todos os desenvolvedores por incansavelmente trabalharem nas melhorias.

  7. #7

    Padrão thunder2.2

    Parabéns a todos citados pelo Luciano no inicio do tópico e ao grande " Mestre " Luciano (m4d3 )

  8. #8

    Padrão

    boas colegas do Under.

    Nao estou conseguindo fazer o thunder passar por cima da regra da simple queue, ele esta cacheando normal, só que só vai a full quando desabilito a simple queue, será que estou errando na marcação de pacotes?
    alguem poderia me ajudar na marcação de pacotes do Thunder e na queue tree
    estou testando a versão 2x
    segue:
    as regras de Mangle

    / ip firewall mangle
    add chain=forward protocol=tcp content="X-Cache: HIT" action=mark-connection \
    new-connection-mark=forward-hits passthrough=yes comment="CACHE FULL" \
    disabled=no
    add chain=forward connection-mark=forward-hits action=mark-packet \
    new-packet-mark=cache-hits passthrough=yes comment="" disabled=no
    add chain=postrouting tos=48 action=mark-connection \
    new-connection-mark=proxy-hits passthrough=yes comment="" disabled=no
    add chain=postrouting connection-mark=proxy-hits action=mark-packet \
    new-packet-mark=proxy-squid passthrough=yes comment="" disabled=no
    add chain=forward src-address=192.168.0.0/24 dst-address=192.168.10.250 \
    protocol=tcp dst-port=3128 action=mark-connection \
    new-connection-mark=thunder-connection passthrough=yes comment="THUNDER \
    CACHE FULL" disabled=yes
    add chain=forward protocol=tcp connection-mark=thunder-connection \
    action=mark-packet new-packet-mark=thunder-packs passthrough=yes \
    comment="" disabled=yes

    e as de Queue tree

    / queue tree
    add name="cache_hits" parent=global-out packet-mark=proxy-squid \
    limit-at=1000000 queue=default priority=8 max-limit=10000000 burst-limit=0 \
    burst-threshold=0 burst-time=0s disabled=no
    add name="cache-antigo" parent=global-out packet-mark=cache-hits \
    limit-at=1000000 queue=default priority=8 max-limit=10000000 burst-limit=0 \
    burst-threshold=0 burst-time=0s disabled=no
    add name="ThunderCache" parent=global-out packet-mark=thunder-packs \
    limit-at=1000000 queue=default priority=8 max-limit=10000000 burst-limit=0 \
    burst-threshold=0 burst-time=0s disabled=no

    lembrando que só estou com problemas nas regras do thunder.

    Se alguem puder ajudar, fico muito grato.

  9. #9

    Padrão

    Citação Postado originalmente por m4d3 Ver Post
    Resolvido, agora rodando ThunderCache 2.2, pra quem quiser só seguir os passos da primeira mensagem deste post.

    Abraço e obrigado a todos os desenvolvedores por incansavelmente trabalharem nas melhorias.

    Ainda não consegui colocar pra rodar o danado, vc vai disponibilizar algum novo script novo grande Luciano?

  10. #10

    Padrão

    OPa gente...Já consegui resolver, o erro estav na forma que eu estava marcando os pacotes do thunder!!!

    abrazzz

  11. #11

    Padrão

    O Thunder 3 já está disponível para testes

    Acessem o forum do Thunder Cache e baixem a sua versão

    aguardamos o feedback de todos.

  12. #12

    Padrão alterações

    Citação Postado originalmente por m4d3 Ver Post
    Resolvido, agora rodando ThunderCache 2.2, pra quem quiser só seguir os passos da primeira mensagem deste post.

    Abraço e obrigado a todos os desenvolvedores por incansavelmente trabalharem nas melhorias.

    meu caro colega mkd3 tive problemas mesmo seguindo suas valiosas dicas e agradeço ja que nao vem nehum "NENHUM" install no thundercache2.2 esta rolando normal esses:
    nod32
    avast
    globo
    xvideos
    symantec
    avg
    4shared
    avira
    windowsupdate
    >>>> youtube (problemas video trava se nao tiver no cache tela preta e mensagem de error) mas depois de estar no cache rola normal)

    seu thunder.lst
    ta assim
    http.*\.4shared\.com.*(\.exe|\.iso|\.torrent|\.zip|\.rar|\.pdf|\.doc|\.tar|\.mp3|\.mp4|\.avi|\.wmv)
    http.*\.avast\.com.*(\.def|\.vpu|\.vpaa|\.stamp)
    http.*(\.avg\.com|\.grisoft\.com).*(\.bin|\.exe)
    http.*(\.avgate\.com|\.avgate\.net|\.freeav\.net).*(\.dll\.gz|\.vdf\.gz)
    http.*flashvideo\.globo\.com.*(\.mp4|\.flv)
    http.*\.googlevideo\.com.*videoplayback
    http.*fpatch\.grandchase\.com\.br.*(\.kom|\.mkom|\.mp3)
    http.*(\.kaspersky-labs\.com|\.geo\.kaspersky\.com).*\.avc
    #http.*\storage\.mais\.uol\.com\.br.*\.flv
    #http.*\.orkut\.com.*\.jpg
    http.*\.pornhub\.com.*\.flv
    http.*\.redtube\.com\/_videos.*flv
    http.*\.terra\.com.*\.flv
    http.*media[a-z0-9]{2}\.tube8\.com.*.*\.flv
    http.*(\.windowsupdate\.com|\.microsoft\.com).*(\.cab|\.exe)
    http.*\.xvideos\.com.*\.flv
    http.*\.youtube\.com.*videoplayback
    http.*\.ytimg\.com.*watch_header\.jpg

    o meu ficou assim:
    http.*\.4shared\.com.*(\.exe|\.iso|\.torrent|\.zip|\.rar|\.pdf|\.doc|\.tar|\.mp3|\.mp4|\.avi|\.wmv)
    http.*\.avast\.com.*(\.def|\.vpu|\.vpaa|\.stamp)
    http.*(\.avg\.com|\.grisoft\.com).*(\.bin|\.exe)
    http.*(\.avgate\.com|\.avgate\.net|\.freeav\.net|\.freeav\.com).*(\.dll\.gz|\.vdf\.gz)
    http.*flashvideo\.globo\.com.*(\.mp4|\.flv)
    http.*\.googlevideo\.com.*videoplayback
    http.*fpatch\.grandchase\.com\.br.*(\.kom|\.mkom|\.mp3)
    http.*(\.kaspersky-labs\.com|\.geo\.kaspersky\.com).*\.avc
    #http.*\storage\.mais\.uol\.com\.br.*\.flv
    #http.*\.orkut\.com.*\.jpg
    http.*\.pornhub\.com.*\.flv
    http.*\.redtube\.com\/_videos.*flv
    http.*\.terra\.com.*\.flv
    http.*media[a-z0-9]{2}\.tube8\.com.*.*\.flv
    http.*(\.windowsupdate\.com|\.microsoft\.com).*(\.cab|\.exe)
    http.*\.xvideos\.com.*\.flv
    http.*\.youtube\.com.*videoplayback
    http.*\.ytimg\.com.*watch_header\.jpg
    http.*(\.avira-update\.com|\.avira\.com).*(\.dll|\.gz|\.vdf|\.gz|\.dat)
    desculpe se eu errei mas tem algumas instençoes q tava faltando "|" nao sei se isso tem problema mas alterei no meu e começou a faser cache do avira graças a Deus pois 80% da minha rede usa ele. mano estou na luta pelo youtube se puder me dar uma força agradeço

    sera que teria de ficar assim:
    http.*(\.youtube\.com.|\googlevideo\.com\)*videoplayback

  13. #13

    Padrão

    Amigo m4d3 como faço pra colocar no relatorio do thunder quais arquivos estão sendo baixados no momento, pois vi no seu ralatorio e é muito chiq, se puder postar como fazer eu agradeço...

  14. #14

    Padrão

    windowsupdate.com.php para:

    Código :
    <?php
    /** 
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    *
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * GNU Library General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with this program; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    *
    * (C) Copyright 2008-2009 Thunder Cache
    *
    * For more information check http://thundercache.org
    *
    * Plugin windowsupdate.com
    * Cache files from windows update, including a balck list of files
    * Need to put ".windowsupdate.com" in squid.conf in line "acl store_rewrite_list dstdomain"
    *
    * @author rodrigo manga <[email protected]>
    */ 
     
    // confs
    $save_quality = false;
    $domain = "windowsupdate";
     
    if (!function_exists('get_filename')){
            function get_filename($url) {
                    $url = preg_replace("/\?/","&",$url);
                    $url = preg_replace("/&/","//",$url);
     
                    if (preg_match("/[0-9]{10}$/", $url, $resultado)) {
                            // metadados
                            $url = explode("/",$url);
                            return $url[(count($url)-3)];
                    } else {
                            // arquivos do winupdate
                            $url = explode("/",$url);
                            return $url[(count($url)-1)];
                    }
     
            }
    }
     
    $black_list = array (
          'muv3muredir.cab',
          'muv3wuredir.cab',
          'vistawuredir.cab',
          'microsoftupdate',
          'webcomtop.js',
          'clientInfo.xml',
          'vistadefault.aspx',
          'version.txt',
          'site',
          'sl-10.xml',
          'v6odf.xml',
          'systeminfoschema.xml',
          'redirect.js',
          'tgar.js',
          'commontop.js',
          'muredir.cab',
          'wuredir.cab',
          'muauth.cab',
          'musetup.cab',
          'winhttp.cab',
          'wsus3setup.cab',
          'authrootstl.cab',
          'authrootseq.txt',
          'default.aspx',
          'vistadefault.aspx',
          'muident.cab',
          'version.txt',
          'clientInfo.xml',
          'favicon.ico',
          'systeminfoschema.xml',
          'UpdateRegulation.asmx',
          'win7muredir.cab',
          'win7wuredir.cab',
          'wuident.cab',
          'ReportingWebService.asmx'
    );
     
    $ext_list = array (
                    '.cab',
                    '.msi',
                    '.exe',
                    '.crt',
                    '.msu',
                    '.psf'
    );
     
    logadd("IN:($ip)$url");
     
    if ( (preg_match("/\.windowsupdate\.com\//", $url,$result)) || (preg_match("/\.update\.microsoft\.com\//", $url,$result)) || (preg_match("/\.dlservice\.microsoft\.com\//", $url,$result))|| (preg_match("/\.download\.microsoft\.com\//", $url,$result)) ){
            // get file name
            $file = get_filename($url);
              $extfile=trim(strtolower(substr($file, -4)));
              if ($file != "" && !in_array($file,$black_list) && in_array($extfile,$ext_list,TRUE)) {
            //if ($file != "" && !in_array($file,$black_list)) {
                    check_file($file,$url,$domain,$ip);
            } else { // dont find file, repass url
                    print "$url\n";
                    logadd("OUT:$url ($file)");
            }
    } else {
            // url not match
            print "$url\n";
            logadd("OUT:$url (dont match)");
    }
     
    ?>

    ln -s windowsupdate.com.php update.microsoft.com.php
    ln -s windowsupdate.com.php dlservice.microsoft.com.php
    ln -s windowsupdate.com.php download.microsoft.com.php



    em functions.php no lugar de:
    Código :
    function check_process($file,$url,$domain,$ip) {
            logadd("Checando...$ip $domain $file");
            include("thunder.conf");
            if (!isset($max_downloaders)) $max_downloaders = 10;
            exec("ps aux|grep downloader.php|grep -v 'grep downloader.php'|grep '$ip'|grep '$domain'|awk '{print $2}'",$return);
     
            array_reverse($return);
     
            for ($i=0;$i<=count($return)-$max_downloaders-1;$i++){
                    logadd("kill $domain $ip(".$return[$i].")");
                    exec("kill -9 ".$return[$i]);
            }
    }


    para:
    Código :
    if ( $domain == "windowsupdate" ){ 
     
    function check_process($file,$url,$domain,$ip) {
            logadd("Checando...$ip $domain $file");
            include("thunder.conf");
            if (!isset($max_downloaders)) $max_downloaders = 10;
            exec("ps aux|grep downloader.php|grep -v 'grep downloader.php'|grep '$ip'|grep '$domain'|awk '{pri
    nt $2}'",$return);
     
            array_reverse($return);
     
            for ($i=0;$i<=count($return)-$max_downloaders-1;$i++){
                    logadd("Windows Update sem limite");
            }
    }
     
     
    }  else  {
     
    function check_process($file,$url,$domain,$ip) {
            logadd("Checando...$ip $domain $file");
            include("thunder.conf");
            if (!isset($max_downloaders)) $max_downloaders = 10;
            exec("ps aux|grep downloader.php|grep -v 'grep downloader.php'|grep '$ip'|grep '$domain'|awk '{print $2}'",$return);
     
            array_reverse($return);
     
            for ($i=0;$i<=count($return)-$max_downloaders-1;$i++){
                    logadd("kill $domain $ip(".$return[$i].")");
                    exec("kill -9 ".$return[$i]);
            }
    }
     
             }



    retira o limite de solicitações por ip para o windows update, para evitar que o download das atualizações seja reiniciado a todo instante.

  15. #15

    Padrão

    Grande Luciano,
    Show de bola ....... valeu .
    Ficou 100% agora.