SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Drupal on IIS with a
SQL Server database
           Alessandro Pilotti
              @alexpilotti
          MVP ASP.NET / IIS




   MCSD, MCAD, MCSE, MCDBA, MCT
      Red Hat Certified Engineer
SQL Server and Drupal
 Drupal offers the option to choose the database backend
   No more limited to MySQL
 Drupal 7 provides great support for SQL Server 2008
   All major modules nowadays use PDO and portable SQL
   Works as well with SQL Server 2008 R2 and 2012
 MS provides a PHP PDO driver for SQL Server
 There’s a free Express edition
   Limited to 10GB per database
 SQL Azure
SQL Server for MySQL devs /
         admins
 SQL Server is a relational database like MySQL
 You can write SQL queries
  (SELECT, INSERT, UPDATE DELETE)
   Like for every other DBMS there are some tricky
    differences
     E.g. MySQL is more forgiving in the GROUP BY clause

 Management tools:
   Management Studio
   sqlcmd.exe
Edition comparison
 Express (free)
   Contains everything you need for the average Drupal site
   Limited to 10GB database size, 1GB memory, 1 socket / 4
     cores

 Web
 Standard
 Enterprise
 Feature comparison charts:
   http://msdn.microsoft.com/en-us/library/cc645993.aspx
SQL Server useful features
 Online backup (included also in express edition!)
    Full
    Differential
    Log

 Replication
    Min. standard edition, web and express only as subscribers

 Mirroring
    Min. standard edition

 Log shipping
    Min. web editition

 Great profiling tools
    UI tools in standard edition
Instances
 You can install multiple isolated instances on the same
  server

 Only one can be the default unnamed instance
 All the others are named
 It means that you connect to the server with a name:
   E.g. yourserverSQLEXPRESS
Databases
 SQL Server instances, like MySQL, contain multiple
  databases

 Every Drupal site has usually a separate database
   Or you can use table_prefix of course
 Databases can be moved to different instances
   detached from one
   Attached to the other
 Databases can be put individually offline
Authentication
 Login
     Credentials needed to connect to the instance
     Windows account (integrated)
       No password, best security approach
     SQL server (mixed mode)
       Classic username and password
     Instance wide roles can be assigned to logins

 Database users
     Specific to each database
     Logins are mapped to database users
     Object level (table, etc) permissions are granted to users

 Roles
     A collection of permissions
     Users can be assigned to roles
Main database roles
 db_owner
   Can do everything on the database (not the instance!)
 db_datareader
   Can run SELECT on any table / view
 db_datawriter
   Can run INSERT, UPDATE, DELETE
 db_ddladmin
   Can run any DDL command (CREATE, DROP, etc)
How to create a database
 Very easily with Management Studio
 Via command line:
  sqlcmd –S .SQLEXPRESS –E

  create database drupal7
  create login drupal7 with password = 'Passw0rd’
  go
  use drupal7
  go
  create user drupal7 for login drupal7
  exec sp_addrolemember db_owner, drupal7
  go
Drupal 7 site with SQL Server
        using WebPi

 With just a few click using WebPi
   Add also:
   SQL Server 2008 R2 Management Studio Express with
     SP1
Drupal 7 site with SQL Server
         w/o WebPi
 Create web site
 Download and install SQL Server PDO driver:
   http://www.microsoft.com/en-
    us/download/details.aspx?id=20098

 Enable PHP extensions php_sqlsrv and
  php_pdo_sqlsrv
   Drush @drupal7 dl sqlsrv
   cd your_drupal_site_path
   xcopy /i sitesallmodulessqlsrvsqlsrv
    includesdatabasesqlsrv
Database management
 Schedule proper backup policy
   With or without transaction log
 Schedule maintenance tasks
   Update statistics
   Reindex
   Shrink database
Backup policy
 Schedule a proper backup policy, e.g.:
   Full database backup every night
   Log every 5’ (or more, depending on your db)
   This way you will not lose more than 5’ of data!
 To be able to backup the transaction log, set the
  database recovery model to
   Full or Bulk-Logged
   Default is Simple
Backup
 Use Management Studio
 or
 BACKUP DATABASE [drupal7] TO DISK =
  N'c:backupdrupal7_backup.bak' WITH INIT, NAME =
  N'drupal7-Full Database Backup’

 Store backups on a remote file share!
   To do that run the SQL service with an ad hoc user
   Create the same user on the server with the network
       share
Set recovery model
 Management Studio (very easy)
 T-SQL (e.g. sqlcmd):
  USE [master]
  GO
  ALTER DATABASE [drupal7] SET RECOVERY FULL
  WITH NO_WAIT
How to schedule a backup
 The express edition of SQL Server doesn’t have a UI to schedule
   backups and other tasks

 We can use the windows scheduler to schedule:
    Full backup every night
    Log backup every 5’
    Delete of old backups every night

schtasks.exe /create /tn drupal7_db_backup_full /tr "sqlcmd -S
.SQLExpress -E -i c:backupdrupal7_backup_full.sql" /sc DAILY /ru
Administrator /rp /st 02:00:00

 Useful task commands:
     schtasks.exe /run /tn drupal7_db_backup_full

     schtasks.exe /delete /tn drupal7_db_backup_full
To schedule a log backup

 E.g.: every 15’:
   schtasks.exe /create /tn drupal7_dbbackup_log /tr
     "sqlcmd -S .SQLExpress -E -i
     c:backupdrupal7_backup_log.sql" /sc MINUTE /MO 15
     /ru administrator /rp
Restore a database
 Best done via Management Studio
 Or manually (here’s a complete sample):
      RESTORE DATABASE [drupal7] FROM DISK =
       N'c:backupdrupal7_backup_full_2012_05_15_14_53_06_470.bak' WITH FILE =
       1, NORECOVERY
      GO
      RESTORE DATABASE [drupal7] FROM DISK =
       N'c:backupdrupal7_backup_diff_2012_05_15_14_53_09_867.bak' WITH FILE =
       1, NORECOVERY
      GO
      RESTORE LOG [drupal7] FROM DISK =
       N'c:backupdrupal7_backup_log_2012_05_15_14_53_13_913.trn' WITH FILE =
       1, NORECOVERY
      GO
      RESTORE LOG [drupal7] FROM DISK =
       N'c:backupdrupal7_backup_log_2012_05_15_14_53_15_200.trn' WITH FILE = 1
      GO

Weitere ähnliche Inhalte

Andere mochten auch

Create Website In Indian Languages using drupal
Create Website In Indian Languages using drupalCreate Website In Indian Languages using drupal
Create Website In Indian Languages using drupaldrupalindia
 
8 Web Practices for Drupal
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for DrupalWingston
 
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehillGeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehillNikhil Deshpande
 
Moving Drupal to the Cloud
Moving Drupal to the CloudMoving Drupal to the Cloud
Moving Drupal to the CloudAri Davidow
 
Drupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows AzureDrupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows AzureFord AntiTrust
 
Data migration to Drupal using the migrate module
Data migration to Drupal using the migrate moduleData migration to Drupal using the migrate module
Data migration to Drupal using the migrate moduleLuc Bézier
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesdrupalindia
 
Content Staging in Drupal 8
Content Staging in Drupal 8Content Staging in Drupal 8
Content Staging in Drupal 8Dick Olsson
 
Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Suzanne Dergacheva
 
Migration from Legacy CMS to Drupal
Migration from Legacy CMS to DrupalMigration from Legacy CMS to Drupal
Migration from Legacy CMS to DrupalRachel Jaro
 
Internet Information Server (IIS)
Internet Information Server (IIS)Internet Information Server (IIS)
Internet Information Server (IIS)Rosariio92
 

Andere mochten auch (16)

Create Website In Indian Languages using drupal
Create Website In Indian Languages using drupalCreate Website In Indian Languages using drupal
Create Website In Indian Languages using drupal
 
Migrate
MigrateMigrate
Migrate
 
8 Web Practices for Drupal
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for Drupal
 
Recipes for Drupal distributions
Recipes for Drupal distributionsRecipes for Drupal distributions
Recipes for Drupal distributions
 
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehillGeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
GeorgiaGov's move to Drupal - presentation by Nikhil Deshpande @nikofthehill
 
Moving Drupal to the Cloud
Moving Drupal to the CloudMoving Drupal to the Cloud
Moving Drupal to the Cloud
 
Drupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows AzureDrupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows Azure
 
Data migration to Drupal using the migrate module
Data migration to Drupal using the migrate moduleData migration to Drupal using the migrate module
Data migration to Drupal using the migrate module
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sites
 
Content Staging in Drupal 8
Content Staging in Drupal 8Content Staging in Drupal 8
Content Staging in Drupal 8
 
Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7Managing Translation Workflows in Drupal 7
Managing Translation Workflows in Drupal 7
 
Migration from Legacy CMS to Drupal
Migration from Legacy CMS to DrupalMigration from Legacy CMS to Drupal
Migration from Legacy CMS to Drupal
 
IIS
IISIIS
IIS
 
Internet Information Server (IIS)
Internet Information Server (IIS)Internet Information Server (IIS)
Internet Information Server (IIS)
 
Understanding IIS
Understanding IISUnderstanding IIS
Understanding IIS
 
YouTube Powerpoint
YouTube PowerpointYouTube Powerpoint
YouTube Powerpoint
 

Mehr von Alessandro Pilotti

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 OcataAlessandro Pilotti
 
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 OpenStackAlessandro Pilotti
 
OpenStack + Nano Server + Hyper-V + S2D
OpenStack + Nano Server + Hyper-V + S2DOpenStack + Nano Server + Hyper-V + S2D
OpenStack + Nano Server + Hyper-V + S2DAlessandro Pilotti
 
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 technologiesAlessandro Pilotti
 
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 WindowsAlessandro 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-InitAlessandro Pilotti
 
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 consoleAlessandro Pilotti
 
Hyper-V OpenStack Nova Compute
Hyper-V OpenStack Nova ComputeHyper-V OpenStack Nova Compute
Hyper-V OpenStack Nova ComputeAlessandro Pilotti
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsAlessandro Pilotti
 
PHP and FastCGI Performance Optimizations
PHP and FastCGI Performance OptimizationsPHP and FastCGI Performance Optimizations
PHP and FastCGI Performance OptimizationsAlessandro Pilotti
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with DrushAlessandro Pilotti
 
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 1Alessandro Pilotti
 
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 RSignalAlessandro Pilotti
 

Mehr von Alessandro Pilotti (16)

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
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on Windows
 
PHP and FastCGI Performance Optimizations
PHP and FastCGI Performance OptimizationsPHP and FastCGI Performance Optimizations
PHP and FastCGI Performance Optimizations
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with Drush
 
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

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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 AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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 WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Kürzlich hochgeladen (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Drupal on IIS with SQL Server

  • 1. Drupal on IIS with a SQL Server database Alessandro Pilotti @alexpilotti MVP ASP.NET / IIS MCSD, MCAD, MCSE, MCDBA, MCT Red Hat Certified Engineer
  • 2. SQL Server and Drupal  Drupal offers the option to choose the database backend  No more limited to MySQL  Drupal 7 provides great support for SQL Server 2008  All major modules nowadays use PDO and portable SQL  Works as well with SQL Server 2008 R2 and 2012  MS provides a PHP PDO driver for SQL Server  There’s a free Express edition  Limited to 10GB per database  SQL Azure
  • 3. SQL Server for MySQL devs / admins  SQL Server is a relational database like MySQL  You can write SQL queries (SELECT, INSERT, UPDATE DELETE)  Like for every other DBMS there are some tricky differences  E.g. MySQL is more forgiving in the GROUP BY clause  Management tools:  Management Studio  sqlcmd.exe
  • 4. Edition comparison  Express (free)  Contains everything you need for the average Drupal site  Limited to 10GB database size, 1GB memory, 1 socket / 4 cores  Web  Standard  Enterprise  Feature comparison charts:  http://msdn.microsoft.com/en-us/library/cc645993.aspx
  • 5. SQL Server useful features  Online backup (included also in express edition!)  Full  Differential  Log  Replication  Min. standard edition, web and express only as subscribers  Mirroring  Min. standard edition  Log shipping  Min. web editition  Great profiling tools  UI tools in standard edition
  • 6. Instances  You can install multiple isolated instances on the same server  Only one can be the default unnamed instance  All the others are named  It means that you connect to the server with a name:  E.g. yourserverSQLEXPRESS
  • 7. Databases  SQL Server instances, like MySQL, contain multiple databases  Every Drupal site has usually a separate database  Or you can use table_prefix of course  Databases can be moved to different instances  detached from one  Attached to the other  Databases can be put individually offline
  • 8. Authentication  Login  Credentials needed to connect to the instance  Windows account (integrated)  No password, best security approach  SQL server (mixed mode)  Classic username and password  Instance wide roles can be assigned to logins  Database users  Specific to each database  Logins are mapped to database users  Object level (table, etc) permissions are granted to users  Roles  A collection of permissions  Users can be assigned to roles
  • 9. Main database roles  db_owner  Can do everything on the database (not the instance!)  db_datareader  Can run SELECT on any table / view  db_datawriter  Can run INSERT, UPDATE, DELETE  db_ddladmin  Can run any DDL command (CREATE, DROP, etc)
  • 10. How to create a database  Very easily with Management Studio  Via command line: sqlcmd –S .SQLEXPRESS –E create database drupal7 create login drupal7 with password = 'Passw0rd’ go use drupal7 go create user drupal7 for login drupal7 exec sp_addrolemember db_owner, drupal7 go
  • 11. Drupal 7 site with SQL Server using WebPi  With just a few click using WebPi  Add also:  SQL Server 2008 R2 Management Studio Express with SP1
  • 12. Drupal 7 site with SQL Server w/o WebPi  Create web site  Download and install SQL Server PDO driver:  http://www.microsoft.com/en- us/download/details.aspx?id=20098  Enable PHP extensions php_sqlsrv and php_pdo_sqlsrv  Drush @drupal7 dl sqlsrv  cd your_drupal_site_path  xcopy /i sitesallmodulessqlsrvsqlsrv includesdatabasesqlsrv
  • 13. Database management  Schedule proper backup policy  With or without transaction log  Schedule maintenance tasks  Update statistics  Reindex  Shrink database
  • 14. Backup policy  Schedule a proper backup policy, e.g.:  Full database backup every night  Log every 5’ (or more, depending on your db)  This way you will not lose more than 5’ of data!  To be able to backup the transaction log, set the database recovery model to  Full or Bulk-Logged  Default is Simple
  • 15. Backup  Use Management Studio  or  BACKUP DATABASE [drupal7] TO DISK = N'c:backupdrupal7_backup.bak' WITH INIT, NAME = N'drupal7-Full Database Backup’  Store backups on a remote file share!  To do that run the SQL service with an ad hoc user  Create the same user on the server with the network share
  • 16. Set recovery model  Management Studio (very easy)  T-SQL (e.g. sqlcmd): USE [master] GO ALTER DATABASE [drupal7] SET RECOVERY FULL WITH NO_WAIT
  • 17. How to schedule a backup  The express edition of SQL Server doesn’t have a UI to schedule backups and other tasks  We can use the windows scheduler to schedule:  Full backup every night  Log backup every 5’  Delete of old backups every night schtasks.exe /create /tn drupal7_db_backup_full /tr "sqlcmd -S .SQLExpress -E -i c:backupdrupal7_backup_full.sql" /sc DAILY /ru Administrator /rp /st 02:00:00  Useful task commands:  schtasks.exe /run /tn drupal7_db_backup_full  schtasks.exe /delete /tn drupal7_db_backup_full
  • 18. To schedule a log backup  E.g.: every 15’:  schtasks.exe /create /tn drupal7_dbbackup_log /tr "sqlcmd -S .SQLExpress -E -i c:backupdrupal7_backup_log.sql" /sc MINUTE /MO 15 /ru administrator /rp
  • 19. Restore a database  Best done via Management Studio  Or manually (here’s a complete sample):  RESTORE DATABASE [drupal7] FROM DISK = N'c:backupdrupal7_backup_full_2012_05_15_14_53_06_470.bak' WITH FILE = 1, NORECOVERY  GO  RESTORE DATABASE [drupal7] FROM DISK = N'c:backupdrupal7_backup_diff_2012_05_15_14_53_09_867.bak' WITH FILE = 1, NORECOVERY  GO  RESTORE LOG [drupal7] FROM DISK = N'c:backupdrupal7_backup_log_2012_05_15_14_53_13_913.trn' WITH FILE = 1, NORECOVERY  GO  RESTORE LOG [drupal7] FROM DISK = N'c:backupdrupal7_backup_log_2012_05_15_14_53_15_200.trn' WITH FILE = 1  GO