SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Drupal, Memcached
and Solr on Windows
           Alessandro Pilotti
              @alexpilotti
          MVP ASP.NET / IIS




   MCSD, MCAD, MCSE, MCDBA, MCT
      Red Hat Certified Engineer
Why Memcached?
 It’s a very popular object caching system
 To speed up web sites by offloading work from the
  DBMS

 Simple key / value store with cache invalidation
 Low CPU usage
 Half client / half server
 Servers are unaware of each other (no sync)
Memcached on Windows
   Memcached supports *nix daemon mode

   Ports for Windows exist
     Most binaries available on the web are old (1.2.x)

   The official git repository contains a Windows compatible branch
     git clone --branch engine-pu https://github.com/memcached/memcached.git
     Currently version 1.6.0 beta

   Older version 1.3.3 available here:
     https://github.com/trondn/memcached.git

   Building Memcached on Windows is not difficult:
     http://trondn.blogspot.de/2010/03/building-memcached-windows.html

   Build x64 version if you need more than 4GB of memory per instance

   Prebuilt binaries:
     http://www.cloudbasesolutions.com/downloads/memcached_x86_1_3_3.zip
     http://www.cloudbasesolutions.com/downloads/memcached_x86_1_6_0_beta1.zip
Installing Memcached on
              Windows
 The best way is to run it as a service
 We can use e.g. Apache Procrun to wrap it
   http://www.apache.org/dist/commons/daemon/binaries/windows
     /

 For security reasons don’t use an account like Administrator
  or System to run it!
 Open the required firewall port(s)
   Default: 11211
 Limit the client IP range as a best practice
 If possible use SASL for authentication
Script 1/2
 Create user:
   net user memcached yourpassword /add
   wmic path Win32_UserAccount where
     Name='memcached' set PasswordExpires=false

 Set service rights
   note: using free Windows 2003 Resource Kit
   ntrights –u memcached +r SeServiceLogonRight
   ntrights –u memcached +r SeBatchLogonRight
Script 2/2
 Create Windows service using Apache Procrun
  prunsrv install memcached --Startup=auto --StartMode=exe
  --StartImage="c:memcachedmemcached.exe"
  ++StartParams=-p;11211;-m;256;-l;127.0.0.1
  --ServiceUser=.memcached --ServicePassword=yourpassword

 For remote host access
   Remove “–l 127.0.0.1”
   Open firewall port
      netsh advfirewall firewall add rule name="memcached" dir=in
       action=allow protocol=TCP localport=11211

 Start service
   net start memcached
Memcached and PHP
 It requires a PECL extension, two are available:
   Memcache
     Win32 binary: http://downloads.php.net/pierre/
   Memcached
     More advanced

 Drupal works with both
Memcached protocol
 Memcache can use an ascii (default) or binary protocol
  (faster)
 Binary protocol supported from version 1.3
 Memcache PECL extension:
   PHP.INI
     memcache.protocol = binary
 Memcached PECL extension:
   Drupal settings.php
     $conf['memcache_options'] = array(
      Memcached::OPT_BINARY_PROTOCOL => TRUE,
     );
Memcached and Drupal 7
 drush @Drupal7 dl memcache
 In “sitesallmodulesmemcachedmemcache.inc”:
    comment //drupal_set_message(t('You must enable the PECL memcached
      or memcache extension to use memcache.inc.'), 'error');

 drush @Drupal7 -y en memcache_admin
 In settings.php
    $conf['cache_backends'][] =
     'sites/all/modules/memcache/memcache.inc';
    $conf['cache_default_class'] = 'MemCacheDrupal';
    $conf['memcache_key_prefix'] = 'drupal7';

 You can now setup separate bins and servers
    Examples: http://drupal.org/node/1131468
Apache Solr
 Open source search platform
   Full text search
   Optimized for high volume web traffic
   Based on Apache Lucene
 Download version 3.5.0 from:
   http://www.apache.org/dyn/closer.cgi/lucene/solr
Solr, Windows and Drupal 7
 Drupal
   drush @Drupal7 dl apachesolr

 Expand the content of “example” in                     “apache-
  solr-3.5.0.zip“ to e.g. c:Solr

 Move c:SolrSolrConf folder to c:SolrConf
   Replace solrconfig.xml and schema.xml and
     protwords.txt with copies from:
      <drupal site>sitesallmodulesapachesolrsolr-conf
        Version 3.x: solrconfig-solr3x.xml schema-solr3x.xml
Create Windows Solr user
 net user solr yourpassword /add
 wmic path Win32_UserAccount where Name='solr'
  set PasswordExpires=false

 ntrights -u solr +r SeServiceLogonRight
 ntrights -u solr +r SeBatchLogonRight
 Set proper folder permissions
   icacls c:solr /inheritance:d /grant solr:(OI)(CI)(F)
    /remove Users
Create Windows service
 Download and install Java JRE 7
      http://www.oracle.com/technetwork/java/javase/downloads/index.html

 Using Apache Procrun x64:
 prunsrv install solr --Startup=auto --StartMode=jvm ++JvmOptions=-
   Dsolr.solr.home=C:/solr/;-Djetty.home=C:/solr/;-Djetty.logs=C:/solr/logs/ -
   -ServiceUser=.solr –ServicePassword=yourpassword --
   Classpath=C:/solr/lib/*.jar;C:/solr/start.jar --
   StartClass=org.mortbay.start.Main

 Start service
      Net start solr

 Open firewall port if remote access is required
      netsh advfirewall firewall add rule name="solr" dir=in action=allow protocol=TCP
       localport=8983
Setup Drupal 7 Solr search
 Enable solr search module:
   drush @drupal7 en –y apachesolr_search
 http://yourdrupalsite/admin/config/search/settings
   Set Apache Solr Search as the only active search module
   Set Apache Solr Search as the default search module
 http://drupal7/admin/config/search/apachesolr/settings
   Set your Solr url, e.g.: http://solrserver:8983/solr
Autocommit maxTime
 Default settings is 120s
 In Drupal, this means that after your data changes are
    received by Solr, your search results will not be
    updated for 2 minutes

 To have a shorter delay (e.g. 20s) change maxTime in
    solrconfig.xml (in ms):

       <maxTime>20000</maxTime>
Drupal cron
 Drupal sends data to Solr for indexing using cron
   This might provide big delays between data changes
 Download elysia_cron module
   drush @drupal7 dl elysia_cron
   drush @drupal7 en elysia_cron –y
 Set cron scheduling as:
   Never / Use external crontab
 Set apachesolr_cron settings to (e.g. every 2’)
   */2 * * * *
“crontab” on Windows
 Windows uses scheduled tasks instead of crontab
 To create a scheduled task for Drupal elysia_cron to run e.g. every
   2’:

 schtasks.exe /create /tn drupal7_cron /tr "wget -O - -q -t 1
   http://drupal7/sites/all/modules/elysia_cron/cron.php?cron_ke
   y=yourcronkey" /sc MINUTE /mo 2 /ru solr /rp
    put wget.exe in the path
    Get your cron key from:
          http://yourdrupalsite/admin/config/system/cron/settings

 To run the task once (troubleshooting, etc):
   schtasks.exe /run /tn drupal7_cron
 To delete the task:
   schtasks.exe /delete /tn drupal7_cron
Drush integration

 drush @drupal7 solr-search something
 drush @drupal7 solr-index
 drush @drupal7 solr-reindex
 drush @drupal7 solr-delete-index

Weitere ähnliche Inhalte

Was ist angesagt?

Step by step_linux_guide
Step by step_linux_guideStep by step_linux_guide
Step by step_linux_guide
vinod31dec
 

Was ist angesagt? (16)

Instalar PENTAHO 5 en CentOS 6
Instalar PENTAHO 5 en CentOS 6Instalar PENTAHO 5 en CentOS 6
Instalar PENTAHO 5 en CentOS 6
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
 
Samba tutorial
Samba tutorialSamba tutorial
Samba tutorial
 
Oracle on Solaris
Oracle on SolarisOracle on Solaris
Oracle on Solaris
 
Bpug mcollective 20140624
Bpug mcollective 20140624Bpug mcollective 20140624
Bpug mcollective 20140624
 
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, PuppetPuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
PuppetConf 2016: Puppet 4.x: The Low WAT-tage Edition – Nick Fagerlund, Puppet
 
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using MetasploitPrivileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
Privileges Escalation by Exploiting Client-Side Vulnerabilities Using Metasploit
 
Changes
ChangesChanges
Changes
 
Step by step_linux_guide
Step by step_linux_guideStep by step_linux_guide
Step by step_linux_guide
 
Making the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocolMaking the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocol
 
Auditing System Password Using L0phtcrack
Auditing System Password Using L0phtcrackAuditing System Password Using L0phtcrack
Auditing System Password Using L0phtcrack
 
Contoh Soal LKS IT Network 2014 Di Palembang Modul 3
Contoh Soal LKS IT Network 2014 Di Palembang Modul 3Contoh Soal LKS IT Network 2014 Di Palembang Modul 3
Contoh Soal LKS IT Network 2014 Di Palembang Modul 3
 
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext PasswordsDumping and Cracking SAM Hashes to Extract Plaintext Passwords
Dumping and Cracking SAM Hashes to Extract Plaintext Passwords
 
Refcard en-a4
Refcard en-a4Refcard en-a4
Refcard en-a4
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
 
Wissbi osdc pdf
Wissbi osdc pdfWissbi osdc pdf
Wissbi osdc pdf
 

Andere mochten auch

Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек Михаил
PVasili
 
Drush installation guide
Drush installation guideDrush installation guide
Drush installation guide
Thierno Fall
 
Depolying Drupal with Git, Drush Make and Capistrano
Depolying Drupal with Git, Drush Make and CapistranoDepolying Drupal with Git, Drush Make and Capistrano
Depolying Drupal with Git, Drush Make and Capistrano
libsys
 
5 Important Tools for Drupal Development
5 Important Tools for Drupal Development5 Important Tools for Drupal Development
5 Important Tools for Drupal Development
jcarrig
 

Andere mochten auch (17)

[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
 
Drupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationDrupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 Migration
 
Drush for humans - SANDcamp 2013
Drush for humans - SANDcamp 2013Drush for humans - SANDcamp 2013
Drush for humans - SANDcamp 2013
 
Getting started with Drupal 8
Getting started with Drupal 8Getting started with Drupal 8
Getting started with Drupal 8
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек Михаил
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with Drush
 
Composer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.pptComposer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.ppt
 
Drush Presentation
Drush PresentationDrush Presentation
Drush Presentation
 
Drush workshop
Drush workshopDrush workshop
Drush workshop
 
Drush installation guide
Drush installation guideDrush installation guide
Drush installation guide
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for Drupal
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
 
Depolying Drupal with Git, Drush Make and Capistrano
Depolying Drupal with Git, Drush Make and CapistranoDepolying Drupal with Git, Drush Make and Capistrano
Depolying Drupal with Git, Drush Make and Capistrano
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
 
Drush - use full power - DrupalCamp Donetsk 2014
Drush - use full power - DrupalCamp Donetsk 2014Drush - use full power - DrupalCamp Donetsk 2014
Drush - use full power - DrupalCamp Donetsk 2014
 
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8[drupalday2017] - DevOps: strumenti di automazione per Drupal8
[drupalday2017] - DevOps: strumenti di automazione per Drupal8
 
5 Important Tools for Drupal Development
5 Important Tools for Drupal Development5 Important Tools for Drupal Development
5 Important Tools for Drupal Development
 

Ähnlich wie Drupal, Memcache and Solr on Windows

Ähnlich wie Drupal, Memcache and Solr on Windows (20)

Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
Install websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsInstall websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bits
 
How to create a secured cloudera cluster
How to create a secured cloudera clusterHow to create a secured cloudera cluster
How to create a secured cloudera cluster
 
Mitre Attack - Credential Dumping - updated.pptx
Mitre Attack - Credential Dumping - updated.pptxMitre Attack - Credential Dumping - updated.pptx
Mitre Attack - Credential Dumping - updated.pptx
 
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
SQL Server Exploitation, Escalation, Pilfering - AppSec USA 2012
 
Lab Manual Managed Database Basics
Lab Manual Managed Database BasicsLab Manual Managed Database Basics
Lab Manual Managed Database Basics
 
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)
 
Building a Gateway Server
Building a Gateway ServerBuilding a Gateway Server
Building a Gateway Server
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker security
Docker securityDocker security
Docker security
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linux
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
Prosit google-cloud
Prosit google-cloudProsit google-cloud
Prosit google-cloud
 
CCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in dockerCCCEU15 run cloudstack in docker
CCCEU15 run cloudstack in docker
 
CloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in DockerCloudStack Collab Conference 2015 Run CloudStack in Docker
CloudStack Collab Conference 2015 Run CloudStack in Docker
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security Paradigm
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
TO Hack an ASP .NET website?
TO Hack an ASP .NET website?  TO Hack an ASP .NET website?
TO Hack an ASP .NET website?
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 

Mehr von Alessandro Pilotti

Interoperable OpenStack guest provisioning with Cloudbase-Init
Interoperable OpenStack guest provisioning with Cloudbase-InitInteroperable OpenStack guest provisioning with Cloudbase-Init
Interoperable OpenStack guest provisioning with Cloudbase-Init
Alessandro Pilotti
 
Hyper-V OpenStack Nova Compute
Hyper-V OpenStack Nova ComputeHyper-V OpenStack Nova Compute
Hyper-V OpenStack Nova Compute
Alessandro Pilotti
 

Mehr von Alessandro Pilotti (14)

OpenStack and Windows - What's new in Ocata
OpenStack and Windows - What's new in OcataOpenStack and Windows - What's new in Ocata
OpenStack and Windows - What's new in Ocata
 
Strategies for migrating workloads from VMware to OpenStack
Strategies for migrating workloads from VMware to OpenStackStrategies for migrating workloads from VMware to OpenStack
Strategies for migrating workloads from VMware to OpenStack
 
Puppet + Windows Nano Server
Puppet + Windows Nano ServerPuppet + Windows Nano Server
Puppet + Windows Nano Server
 
OpenStack + Nano Server + Hyper-V + S2D
OpenStack + Nano Server + Hyper-V + S2DOpenStack + Nano Server + Hyper-V + S2D
OpenStack + Nano Server + Hyper-V + S2D
 
Building a Microsoft cloud with open technologies
Building a Microsoft cloud with open technologiesBuilding a Microsoft cloud with open technologies
Building a Microsoft cloud with open technologies
 
OpenStack Summit 2013 Hong Kong - OpenStack and Windows
OpenStack Summit 2013 Hong Kong - OpenStack and WindowsOpenStack Summit 2013 Hong Kong - OpenStack and Windows
OpenStack Summit 2013 Hong Kong - OpenStack and Windows
 
Interoperable OpenStack guest provisioning with Cloudbase-Init
Interoperable OpenStack guest provisioning with Cloudbase-InitInteroperable OpenStack guest provisioning with Cloudbase-Init
Interoperable OpenStack guest provisioning with Cloudbase-Init
 
OpenStack and Windows
OpenStack and WindowsOpenStack and Windows
OpenStack and Windows
 
An HTML5 client to connect to the Hyper-V console
An HTML5 client to connect to the Hyper-V consoleAn HTML5 client to connect to the Hyper-V console
An HTML5 client to connect to the Hyper-V console
 
Hyper-V OpenStack Nova Compute
Hyper-V OpenStack Nova ComputeHyper-V OpenStack Nova Compute
Hyper-V OpenStack Nova Compute
 
PHP and FastCGI Performance Optimizations
PHP and FastCGI Performance OptimizationsPHP and FastCGI Performance Optimizations
PHP and FastCGI Performance Optimizations
 
Building drupal web farms with IIS - part 1
Building drupal web farms with IIS - part 1Building drupal web farms with IIS - part 1
Building drupal web farms with IIS - part 1
 
Windows Loves drupal
Windows Loves drupalWindows Loves drupal
Windows Loves drupal
 
Building modern web sites with ASP .Net Web API, WebSockets and RSignal
Building modern web sites with ASP .Net Web API, WebSockets and RSignalBuilding modern web sites with ASP .Net Web API, WebSockets and RSignal
Building modern web sites with ASP .Net Web API, WebSockets and RSignal
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Drupal, Memcache and Solr on Windows

  • 1. Drupal, Memcached and Solr on Windows Alessandro Pilotti @alexpilotti MVP ASP.NET / IIS MCSD, MCAD, MCSE, MCDBA, MCT Red Hat Certified Engineer
  • 2. Why Memcached?  It’s a very popular object caching system  To speed up web sites by offloading work from the DBMS  Simple key / value store with cache invalidation  Low CPU usage  Half client / half server  Servers are unaware of each other (no sync)
  • 3. Memcached on Windows  Memcached supports *nix daemon mode  Ports for Windows exist  Most binaries available on the web are old (1.2.x)  The official git repository contains a Windows compatible branch  git clone --branch engine-pu https://github.com/memcached/memcached.git  Currently version 1.6.0 beta  Older version 1.3.3 available here:  https://github.com/trondn/memcached.git  Building Memcached on Windows is not difficult:  http://trondn.blogspot.de/2010/03/building-memcached-windows.html  Build x64 version if you need more than 4GB of memory per instance  Prebuilt binaries:  http://www.cloudbasesolutions.com/downloads/memcached_x86_1_3_3.zip  http://www.cloudbasesolutions.com/downloads/memcached_x86_1_6_0_beta1.zip
  • 4. Installing Memcached on Windows  The best way is to run it as a service  We can use e.g. Apache Procrun to wrap it  http://www.apache.org/dist/commons/daemon/binaries/windows /  For security reasons don’t use an account like Administrator or System to run it!  Open the required firewall port(s)  Default: 11211  Limit the client IP range as a best practice  If possible use SASL for authentication
  • 5. Script 1/2  Create user:  net user memcached yourpassword /add  wmic path Win32_UserAccount where Name='memcached' set PasswordExpires=false  Set service rights  note: using free Windows 2003 Resource Kit  ntrights –u memcached +r SeServiceLogonRight  ntrights –u memcached +r SeBatchLogonRight
  • 6. Script 2/2  Create Windows service using Apache Procrun prunsrv install memcached --Startup=auto --StartMode=exe --StartImage="c:memcachedmemcached.exe" ++StartParams=-p;11211;-m;256;-l;127.0.0.1 --ServiceUser=.memcached --ServicePassword=yourpassword  For remote host access  Remove “–l 127.0.0.1”  Open firewall port  netsh advfirewall firewall add rule name="memcached" dir=in action=allow protocol=TCP localport=11211  Start service  net start memcached
  • 7. Memcached and PHP  It requires a PECL extension, two are available:  Memcache  Win32 binary: http://downloads.php.net/pierre/  Memcached  More advanced  Drupal works with both
  • 8. Memcached protocol  Memcache can use an ascii (default) or binary protocol (faster)  Binary protocol supported from version 1.3  Memcache PECL extension:  PHP.INI  memcache.protocol = binary  Memcached PECL extension:  Drupal settings.php $conf['memcache_options'] = array( Memcached::OPT_BINARY_PROTOCOL => TRUE, );
  • 9. Memcached and Drupal 7  drush @Drupal7 dl memcache  In “sitesallmodulesmemcachedmemcache.inc”:  comment //drupal_set_message(t('You must enable the PECL memcached or memcache extension to use memcache.inc.'), 'error');  drush @Drupal7 -y en memcache_admin  In settings.php  $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';  $conf['cache_default_class'] = 'MemCacheDrupal';  $conf['memcache_key_prefix'] = 'drupal7';  You can now setup separate bins and servers  Examples: http://drupal.org/node/1131468
  • 10. Apache Solr  Open source search platform  Full text search  Optimized for high volume web traffic  Based on Apache Lucene  Download version 3.5.0 from:  http://www.apache.org/dyn/closer.cgi/lucene/solr
  • 11. Solr, Windows and Drupal 7  Drupal  drush @Drupal7 dl apachesolr  Expand the content of “example” in “apache- solr-3.5.0.zip“ to e.g. c:Solr  Move c:SolrSolrConf folder to c:SolrConf  Replace solrconfig.xml and schema.xml and protwords.txt with copies from:  <drupal site>sitesallmodulesapachesolrsolr-conf  Version 3.x: solrconfig-solr3x.xml schema-solr3x.xml
  • 12. Create Windows Solr user  net user solr yourpassword /add  wmic path Win32_UserAccount where Name='solr' set PasswordExpires=false  ntrights -u solr +r SeServiceLogonRight  ntrights -u solr +r SeBatchLogonRight  Set proper folder permissions  icacls c:solr /inheritance:d /grant solr:(OI)(CI)(F) /remove Users
  • 13. Create Windows service  Download and install Java JRE 7  http://www.oracle.com/technetwork/java/javase/downloads/index.html  Using Apache Procrun x64:  prunsrv install solr --Startup=auto --StartMode=jvm ++JvmOptions=- Dsolr.solr.home=C:/solr/;-Djetty.home=C:/solr/;-Djetty.logs=C:/solr/logs/ - -ServiceUser=.solr –ServicePassword=yourpassword -- Classpath=C:/solr/lib/*.jar;C:/solr/start.jar -- StartClass=org.mortbay.start.Main  Start service  Net start solr  Open firewall port if remote access is required  netsh advfirewall firewall add rule name="solr" dir=in action=allow protocol=TCP localport=8983
  • 14. Setup Drupal 7 Solr search  Enable solr search module:  drush @drupal7 en –y apachesolr_search  http://yourdrupalsite/admin/config/search/settings  Set Apache Solr Search as the only active search module  Set Apache Solr Search as the default search module  http://drupal7/admin/config/search/apachesolr/settings  Set your Solr url, e.g.: http://solrserver:8983/solr
  • 15. Autocommit maxTime  Default settings is 120s  In Drupal, this means that after your data changes are received by Solr, your search results will not be updated for 2 minutes  To have a shorter delay (e.g. 20s) change maxTime in solrconfig.xml (in ms):  <maxTime>20000</maxTime>
  • 16. Drupal cron  Drupal sends data to Solr for indexing using cron  This might provide big delays between data changes  Download elysia_cron module  drush @drupal7 dl elysia_cron  drush @drupal7 en elysia_cron –y  Set cron scheduling as:  Never / Use external crontab  Set apachesolr_cron settings to (e.g. every 2’)  */2 * * * *
  • 17. “crontab” on Windows  Windows uses scheduled tasks instead of crontab  To create a scheduled task for Drupal elysia_cron to run e.g. every 2’:  schtasks.exe /create /tn drupal7_cron /tr "wget -O - -q -t 1 http://drupal7/sites/all/modules/elysia_cron/cron.php?cron_ke y=yourcronkey" /sc MINUTE /mo 2 /ru solr /rp  put wget.exe in the path  Get your cron key from:  http://yourdrupalsite/admin/config/system/cron/settings  To run the task once (troubleshooting, etc):  schtasks.exe /run /tn drupal7_cron  To delete the task:  schtasks.exe /delete /tn drupal7_cron
  • 18. Drush integration  drush @drupal7 solr-search something  drush @drupal7 solr-index  drush @drupal7 solr-reindex  drush @drupal7 solr-delete-index