יצירת מכונת Memorystore for Memcached באמצעות מסוף Google Cloud

במדריך למתחילים הזה מוסבר איך ליצור מופע של Memorystore for Memcached, להתחבר למופע, להגדיר ערך, לאחזר ערך ולמחוק את המופע.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  5. Verify that billing is enabled for your Google Cloud project.

  6. מפעילים את Service Networking API בפרויקט.
    הפעלת Service Networking API
  7. מפעילים בפרויקט את Memorystore for Memcached API.
    הפעלת Memorystore for Memcached API

יצירת מופע Memcached

  1. עוברים לדף Memorystore for Memcached במסוף Google Cloud .
    Memorystore for Memcached

  2. לוחצים על הלחצן יצירת מופע.

  3. בדף Create a Memcached instance במסוף Google Cloud , בוחרים את ההגדרות למופע החדש:

    • מזינים מזהה מופע שכולל רק אותיות קטנות, מספרים ומקפים. להתחיל באות.
      • לדוגמה, my-memcached-instance-1.
    • בתפריט הנפתח אזור, בוחרים באפשרות us-central1.
    • בוחרים באפשרות Automatically distribute בתפריט הנפתח אזור.
    • מזינים 2 בקטע Nodes כדי ליצור שני צמתים.
    • בוחרים באפשרות זיכרון לכל צומת בנפח 1GB.
    • בוחרים באפשרות 1 בשדה Cores per node (ליבות לכל צומת).
    • בוחרים באפשרות default בשדה רשת מורשית.

  4. לוחצים על יצירה.

  5. אחרי שיוצרים את המופע, לוחצים על מזהה המופע כדי לראות את דף הפרטים של המופע.

  6. רושמים את IP address של אחד מהצמתים.

התחברות למופע ממכונה וירטואלית ב-Compute Engine

כדי לבדוק את החיבור:

  1. מתחברים ל-VM של Linux. הוראות להתחברות ל-VM של Linux מפורטות במאמר מדריך למתחילים: שימוש ב-VM של Linux. אם השתמשתם באימג' שמבוסס על Debian כדי ליצור את המכונה הווירטואלית, כפי שמתואר במדריך לתחילת העבודה, אתם יכולים להתקין את telnet באמצעות apt-get:

    sudo apt-get install telnet
    
  2. מהטרמינל, מפעילים telnet לכתובת ה-IP של אחד מצמתי Memcached. מחליפים את node-ip-address בכתובת ה-IP של הצומת.

    telnet node-ip-address 11211
    

    הפלט אמור להיראות כך, כשבמקום [bracketed-variables] מופיעים המשתנים של הפרויקט:

    Trying [node-ip-address]…
    Connected to [node-ip-address]
    
  3. בסשן של telnet, מזינים כמה פקודות Memcached:

    צריך להזין את הפרטים הבאים:

    get greeting
    

    תוצאה:

    END
    

    צריך להזין את הפרטים הבאים:

    set greeting 1 0 11
    hello world
    

    תוצאה:

    STORED
    

    צריך להזין את הפרטים הבאים:

    get greeting
    

    תוצאה:

    VALUE greeting 1 11
    hello world
    END
    

‫Memorystore for Memcached תומך בספריות Memcached סטנדרטיות בקוד פתוח.

הסרת המשאבים

כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה, פועלים לפי השלבים הבאים:

  1. עוברים לדף Memorystore for Memcached במסוף Google Cloud .
    Memorystore for Memcached

  2. לוחצים על המזהה של המופע שרוצים למחוק.

  3. לוחצים על הלחצן Delete.

  4. בהנחיה שמופיעה, מזינים את מזהה המופע.

  5. לוחצים על הלחצן Delete.

המאמרים הבאים