vagarnt-oracel19でvirtualbox上にOracleを作成し、ホストのWindowsからはSQLDeveloperで疎通できるようになりました。
vagrantcentOS7をvirtualbox上に作成し、Laravelの環境構築をし、OracleClientなどOracle接続に必要なものは入れました。
LaravelからDBサーバー間の疎通をしようとしましたが、
PHP Warning: oci_connect(): ORA-12541: TNS:no listener in /var/www/html/laravel/vendor/yajra/laravel-pdo-via-oci8/src/Pdo/Oci8.php on line 473 Yajra/Pdo/Oci8/Exceptions/Oci8Exception with message 'ORA-12541: TNS:no listener'
リスナーが立ち上がってないとの事でしたので、Oracle側の確認をしましたがリスナーは立ち上がってました。
[oracle@oracle-19c-vagrant vagrant]$ lsnrctl start LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-JUN-2020 16:29:28 Copyright (c) 1991, 2019, Oracle. All rights reserved. TNS-01106: Listener using listener name LISTENER has already been started
virtual box間のネットワークの設定でしょうか?
分かる方教えて下さい。
修正依頼内容
バージョン
$ vagrant --version Vagrant 2.2.9
centOSのVagrantfile
# -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "centos/7" config.vm.network "forwarded_port", guest: 22, host: 2223, id: "ssh" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. # config.vm.box_check_update = false # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port # config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access # via 127.0.0.1 to disable public access # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" # Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "1024" # end # # View the documentation for the provider you are using for more # information on available options. # Enable provisioning with a shell script. Additional provisioners such as # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. # config.vm.provision "shell", inline: <<-SHELL # apt-get update # apt-get install -y apache2 # SHELL end
oracleのVagrantfile
# # LICENSE UPL 1.0 # # Copyright (c) 2018, 2020 Oracle and/or its affiliates. # # Since: July, 2018 # Author: gerald.venzl@oracle.com # Description: Creates an Oracle database Vagrant virtual machine. # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # # -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" # Box metadata location and box name BOX_URL = "https://oracle.github.io/vagrant-boxes/boxes" BOX_NAME = "oraclelinux/7" # define hostname NAME = "oracle-19c-vagrant" unless Vagrant.has_plugin?("vagrant-proxyconf") puts 'Installing vagrant-proxyconf Plugin...' system('vagrant plugin install vagrant-proxyconf') end # get host time zone for setting VM time zone, if possible # can override in env section below offset_sec = Time.now.gmt_offset if (offset_sec % (60 * 60)) == 0 offset_hr = ((offset_sec / 60) / 60) timezone_suffix = offset_hr >= 0 ? "-#{offset_hr.to_s}" : "+#{(-offset_hr).to_s}" SYSTEM_TIMEZONE = 'Etc/GMT' + timezone_suffix else # if host time zone isn't an integer hour offset, fall back to UTC SYSTEM_TIMEZONE = 'UTC' end # define listener and EM Express ports LISTENER_PORT = 1522 EM_EXPRESS_PORT = 5501 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = BOX_NAME config.vm.box_url = "#{BOX_URL}/#{BOX_NAME}.json" config.vm.define NAME # change memory size config.vm.provider "virtualbox" do |v| v.memory = 2048 v.name = NAME end config.vm.provider :libvirt do |v| v.memory = 2048 end # add proxy configuration from host env - optional if Vagrant.has_plugin?("vagrant-proxyconf") puts "getting Proxy Configuration from Host..." if ENV["http_proxy"] puts "http_proxy: " + ENV["http_proxy"] config.proxy.http = ENV["http_proxy"] end if ENV["https_proxy"] puts "https_proxy: " + ENV["https_proxy"] config.proxy.https = ENV["https_proxy"] end if ENV["no_proxy"] config.proxy.no_proxy = ENV["no_proxy"] end end # VM hostname config.vm.hostname = NAME # Oracle port forwarding config.vm.network "forwarded_port", guest: LISTENER_PORT, host: LISTENER_PORT config.vm.network "forwarded_port", guest: EM_EXPRESS_PORT, host: EM_EXPRESS_PORT # Provision everything on the first run config.vm.provision "shell", path: "scripts/install.sh", env: { "ORACLE_BASE" => "/opt/oracle", "ORACLE_HOME" => "/opt/oracle/product/19c/dbhome_1", "ORACLE_SID" => "ORCLCDB", "ORACLE_PDB" => "ORCLPDB1", "ORACLE_CHARACTERSET" => "AL32UTF8", "ORACLE_EDITION" => "EE", "LISTENER_PORT" => LISTENER_PORT, "EM_EXPRESS_PORT" => EM_EXPRESS_PORT, "SYSTEM_TIMEZONE" => SYSTEM_TIMEZONE } end 現状、仮想マシン(DBサーバー)にprivateIpを振って、仮想マシン(APサーバー)と仮想マシン(DBサーバー)間でのpingの疎通確認ができました。 エラー内容も変更にあったので、仮想マシン間での疎通は出来てそうです。
回答1件
あなたの回答
tips
プレビュー